Forum Discussion
Counting Zero-Value Measure Rows in Median Calculations
I need the median value of a column (whose value is derived from a measure). In every attempt, it is only returning the median of rows that have a value greater than zero.
I have two tables, one is an "employee" table and one an "attendee" table. I have a measure that counts each time an employee is in the attendee table:
Hi,
Please try this measure:
MED Col A = MEDIANX(SUMMARIZE(Employee_M,Employee_M[Employee ID],"EE",[EE Attend]),[EE])The result shows:
See my attached pbix file.
Best Regards,
Giotto
9 Replies
- Greg_DecklerCommunity Champion
Well, all I can say from the information provided is that you are doing something wrong in your calculation. Because MEDIAN and MEDIANX work for your data. See attached PBIX.
- v-gizhi-msftCommunity Support
- J2KHelper I
Hi All,
Thank you for your replies. My numbers are not coming from a static table (as in Greg_Deckler's .pbix), they are being generated by a counting measure. I would love to post a .pbix file to show this, but it does not look like I can. I have no option to add an attachment to my posts/replies.
Edit: Here are some screen shots that I hope will help explain this further (note that these numbers will be different from my original post).
Here are the two tables:
Here is the relationship:
The visual is a table, with two columns, the first being Employee_M[Employee ID], and the second being this measure:
EE Attend TOT = SUMX(Employee_M,[EE Attend])The second part of that measure uses this measure:EE Attend = CALCULATE(COUNTROWS('Attendee_R'), FILTER('Attendee_R', 'Attendee_R'[Employee ID] = MAX(Employee_M[Employee ID]) )) + 0My median measure is:MED Col A = MEDIANX(SUMMARIZE('Attendee_R',Employee_M[Employee ID]),[EE Attend])This is the result:- Greg_DecklerCommunity Champion
J2K Most people use OneDrive or Box or some other file sharing service to share PBIX files.
- J2KHelper I
Greg_Deckler Here you go:
https://www.dropbox.com/sh/e9nhfa9ct8lvgdt/AABA4QgxXplpOARmOqiK4qlpa?dl=0&preview=MedianDemo.pbix
Again, I appreciate that you take the time to look at these things.
- J2KHelper I
I should mention that the reason why I am not using a calculated column is that I need to be able to filter by dates.