Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tanshaun95
Regular Visitor

Counting Attendance Percentage per Function

Hi all,

 

My PBI is linked to a Sharepoint which is populated by a Power Apps. 

 

The PowerApp is updated once a day, and is meant for Tier reporting. During the submission of the PowerApp, the user selects a field with multiple checkbox to select which departments/functions are present for the meeting that day. This then translates to a Option column in Sharepoint with "A,B,C,D,E".


I converted this in PBI to a Matrix, and there is a separate query with 2 columns. 1 with the unique ID that corresponds to each meeting, and the other reflects the departments present for that meeting. 

Eg. (ABC present for meeting 1, AB present for meeting 2)

ID     Department
1       A
1       B
1       C
2       A

2       B

I want to create a query which trends the attendance of each department. I managed to come up with a measure that counts the number of meetings attended per function: 

  COUNTAx(filter(Attendance,[ID]),Attendance[field_1])
 
However, I am unable to create a static grand total of number of meetings held. I am using 
CALCULATE ( COUNTROWS(Tier2Data ), ALL ( Tier2Data ), however it is being affected by the filter/slicer. It thus results in a result of 100% as the 2 measures end up with the same value. 
tanshaun95_0-1662663534649.pngtanshaun95_1-1662663545472.png

 



The percentages should also not add up to 100%, I would expect there to be multiple functions that are attending the meetings 7/10 times (70%).

Can anyone help me with coming up with a measure that will achieve the above function?
1 ACCEPTED SOLUTION

I agree with what the video told you. If I understand then, your attendence table looks like this

jgeddes_0-1663169448457.png

If that is the case then you can take the distinct count of the meeting id to get the number of meetings. Which is what this formula does: calculate(DISTINCTCOUNT(attendanceTable[ID]),All(attendanceTable))

I am thinking the error is occuring when you try to do a distinct count from the other table.

jgeddes_1-1663169623384.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

9 REPLIES 9
jgeddes
Super User
Super User

Do you have an attendance table and a Tier 2Data table or is it just one table you are working with?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi,

 

To clarify, I have 2 tables.

 

So the original field I get from PowerApps concantenates all the different departments together. I watched a video and was told that it would be best to split out that column and create a new table which is illustrated in the images in the original post.

I agree with what the video told you. If I understand then, your attendence table looks like this

jgeddes_0-1663169448457.png

If that is the case then you can take the distinct count of the meeting id to get the number of meetings. Which is what this formula does: calculate(DISTINCTCOUNT(attendanceTable[ID]),All(attendanceTable))

I am thinking the error is occuring when you try to do a distinct count from the other table.

jgeddes_1-1663169623384.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





That worked! Thank you!

If I wanted to then create a filter to drill down the percentage such that it will change according to the month, may I know how I can do that?

Happy it worked for you.

If you want to filter by date you will need to have whichever table contains both meeting id and the date the meeting was held related to the attendence table by meeting id. 

You would then be able to use the meeting dates to filter the attendence results. 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Another quick question,

 

As I am pulling out the concantenated values and pulling it into the "Attendance" table, only the departments that are selected in the PowerApp (present departments) are reflected in the table.

 

Is there a way where I can pull ALL departments into the table, but reflect "present" if they are selected, and "absent" if they are not? I think this would make it easier to get the drilldown results that would fit my usecase.

If there is a relationship between the master department list and the attendence table you can put the master department list column in your visual that has the attendence measure and select Show items with no data

jgeddes_0-1663186513220.png

you should end up with something like

jgeddes_1-1663186538108.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





jgeddes
Super User
Super User

You can try;

% Meetings Attended =
var _allMeetings =
calculate(DISTINCTCOUNT(attendanceTable[ID]),All(attendanceTable))
Return
DIVIDE([Meetings Attended],_allMeetings,0)



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi,

 

Unfortunately I get the same result as follows:

tanshaun95_0-1662667560192.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.