Forum Discussion
Anonymous
6 years agoNot applicable
Current Status Filter
I have a Power BI table with a Location/ Item key, Audit Date and Item Status (as shown below). I need to add a filter in my reports that will shows only the most current status of each Location/Ite...
- 6 years ago
Hi Anonymous
Create a measure and add it to visual level filter, then add [Status] to a slicer, you can filter the status.
flag1 = VAR maxdate = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Location/Item] = MAX ( 'Table'[Location/Item] ) ) ) RETURN IF ( MAX ( 'Table'[Date] ) = maxdate, 1, 0 )2. if you want to apply filter (active or inactive) in this manner:
show the lastest date's data which their status is active or inactive via slicer.
You could create a table
Status = VALUES('Table'[Status])Add [status] from this table to slicer, create measure below and add to viusal level filter
flag2 = VAR maxdate = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Location/Item] = MAX ( 'Table'[Location/Item] ) ) ) VAR maxdate_m = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Location/Item] = MAX ( 'Table'[Location/Item] ) && 'Table'[Status] = SELECTEDVALUE ( 'Status'[Status] ) ) ) VAR switch1 = IF ( HASONEVALUE ( 'Status'[Status] ), maxdate_m, maxdate ) RETURN IF ( MAX ( 'Table'[Date] ) = switch1, 1, 0 )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-juanli-msft
6 years agoCommunity Support
Hi Anonymous
Is this problem sloved?
If it is sloved, could you kindly accept it as a solution to close this case and help the other members find it more quickly?
If not, please feel free to let me know.
Best Regards
Maggie