Forum Discussion
Filtering a table based on selected filters and getting a subset
I have a table with below fields: name date responsetime NumberOfFailures Region I need to have two filters: Date Filter: Slicer to select date range Checkbox to select a region Based on filters above i need to get below data: Top 10 rows with highest response time Top 10 rows with least response time The problem is the above data should be dynamic, based on region and date filter. 1. I am unable to apply selected filters on the given table 2. I am unable to filter top 10 rows based on filters Any leads are highly appreciated....
Hi Anonymous ,
Create date and region dimension tables as slicers.
Then create measure like this and apply it to visual level filter.
3 per Region = VAR top_3 = CALCULATE ( RANKX ( ALLSELECTED ( 'Table'[api name] ), 'Table'[Total time],, DESC, DENSE ) ) VAR least_3 = CALCULATE ( RANKX ( ALLSELECTED ( 'Table'[api name] ), 'Table'[Total time],, ASC, DENSE ) ) RETURN IF ( MAX ( 'Table'[date] ) IN VALUES ( 'Table 2'[date] ) && MAX ( 'Table'[region] ) IN VALUES ( 'Table 3'[region] ) && ( top_3 <= 3 || least_3 <= 4 ), 1 )Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- amitchandak
Super User
Anonymous , I do not see any data shared or Table structured shared. Can you share sample data and sample output in a table format?
At a first look looks like a case of Rank. You can use Rank with all selected.
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415 - AnonymousNot applicable
Data :
- V-lianl-msft
Community Support
Hi Anonymous ,
Create date and region dimension tables as slicers.
Then create measure like this and apply it to visual level filter.
3 per Region = VAR top_3 = CALCULATE ( RANKX ( ALLSELECTED ( 'Table'[api name] ), 'Table'[Total time],, DESC, DENSE ) ) VAR least_3 = CALCULATE ( RANKX ( ALLSELECTED ( 'Table'[api name] ), 'Table'[Total time],, ASC, DENSE ) ) RETURN IF ( MAX ( 'Table'[date] ) IN VALUES ( 'Table 2'[date] ) && MAX ( 'Table'[region] ) IN VALUES ( 'Table 3'[region] ) && ( top_3 <= 3 || least_3 <= 4 ), 1 )Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.