Forum Discussion
TOP N After a Table Filter Is Applied
- 1 year ago
Hi bendsteel6 ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Chaithra E
Hi bendsteel6 ,
Thank you for reaching out Microsoft Community.
You can apply a TOP N filter on a field in a table visual, after a filter has been applied on another field, such as filtering PART_NAMEs where Claims > 10. The TOP N filter (in the visual’s filter pane) doesn't "see" filters applied by other visuals or measure logic, so it evaluates TOP N before filters like Claims > 10 are applied — hence the unexpected behavior you're seeing.
Power BI’s built-in TOP N filter in the visual pane does not respect filters applied by measures or conditions like "Claims > 10". Still here is an workaround you can try.
Let’s say your table visual includes:
Psrt_name
Avg_Claim_Pay (a measure)
Claims (a count of claims — also a measure),
and you want:
Only rows where Claims > 10
Then, among those, the Top N by Avg_Claim_Pay
Create a Claim Count measure:
Claim_Count =
CALCULATE(COUNTROWS('ClaimsTable'))
Create Avg_Claim_Pay if you haven't already:
Avg_Claim_Pay :=
DIVIDE(SUM('ClaimsTable'[Claim_Pay]), [Claim_Count])
Create a ranking measure that respects the Claims > 10 condition:
Rank_By_Avg_Claim_Pay :=
RANKX(
FILTER(
ALL('ClaimsTable'[PART_NAME]),
[Claim_Count] > 10
),
[Avg_Claim_Pay],
, DESC )
Apply visual-level filters:
Claim_Count > 10
Rank_By_Avg_Claim_Pay <= N
If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.
Regards,
Chaithra