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
bdeluca
Frequent Visitor

Filter matrix based on single value

Thanks ahead of time for the help.

 

bdeluca_0-1615912968483.png

I would like to filter out any employee if ALL entries are "-GOOD-". However, if even one entry is not "-GOOD-", he/she should not be filtered. The matrix is populated with this measure:

 

missing_hours = IF('Metrics_TimeEntry'[Total Hours] >38, "-GOOD-", IF(ISBLANK('Metrics_TimeEntry'[Total Hours]),0,'Metrics_TimeEntry'[Total Hours]))
 
I also created this measure in a (failed) attempt to filter:
 
missing_hours_filter = IF(CALCULATE('Metrics_TimeEntry'[Total Hours],FILTER('Dates', WEEKNUM('dates'[Date],2)))>38,0,1)

 

My idea was that if sum[missing_hours_filter] > 0 , then that employee would not be filtered out of the matrix.....but that doesn't work.

2 REPLIES 2
lbendlin
Super User
Super User

Remember that measures are calculated for every element of your visual separately.  For a matrix visual that means four different calculations: cell, row totals, column totals, and grand total.  In your case you need to write a measure that calculates the row total based on all the column values for that row.  That means you need to use an aggregator function.  

if you want more guidance please post sample data in usable format (not as a picture).

Here is a link to a sample dataset. The measures, tables, etc. are titled just as they are above.

 

https://drive.google.com/file/d/1TDVmGQcTQNk6-3f7XyKgAC33X2u8K87k/view?usp=sharing

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.

Top Solution Authors