Forum Discussion
Visual filter by Measure or maybe Conditional filter
There is a card that shows Yes or No. Then there is a table with 3 columns (Name, Number, Next Audit). Here is a measure for a card:
Audit (Card) =
VAR HasOverdue =
CALCULATE(
COUNTROWS('AUDIT'),
'AUDIT'[Audit] = "Overdue"
)
RETURN
IF(HasOverdue > 0, "Yes", "No")
So when I select a specific date and Country, the card shows me Yes or No.
How can I filter the rows that contain only the values which I see on the card?
12 Replies
- CookistadorSuper User
You have to add your measure in the Table to be able to filter with it
When I have to do that, I add the mesure and I hidde it (replace the name by a space and give the same color to the font and the background color)
- Mera9Frequent Visitor
Then I see just a column with Yes and No in all rows.
- v-kpoloju-msftCommunity Support
Hi Mera9,
Thank you for reaching out to the Microsoft Fabric Community Forum. Thank you Cookistador, for your inputs on this thread.
Right now, the card and table are independent the table does not filter itself based on the "Yes"/"No" shown on the card.- Visual-level filters in Power BI don't directly reference a value from another visual (card → table).
- Measures cannot directly control visual filtering unless specially designed.
They are missing a dynamic connection between the Card's logic and the Table filtering.
Create a New Measure to Filter the Table:Show Row Based on Audit Card = VAR HasOverdue = CALCULATE( COUNTROWS('AUDIT'), 'AUDIT'[Audit] = "Overdue" ) RETURN IF( HasOverdue > 0 && 'AUDIT'[Audit] = "Overdue", 1, 0 )Now, go to the Table visual:
- Drag Show Row Based on Audit Card into the Filters pane of the Table.
- Set the filter to show only when Show Row Based on Audit Card = 1.
This way:
- If the card says Yes (overdue audits exist), the table only shows "Overdue" rows.
- If the card says No (no overdue audits), the table will show nothing.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.- Mera9Frequent Visitor
This is not the right logic. If I select Country, and the table shows me 30 rows (columns Name, Number, Next Audit) where 2 are 'yes' and 28 are 'no', then in the card it shows 'yes', and in the table I need to see only 2 'yes'. And if there are absent 'yes' values, then I need to see 'no' in the card and just rows that include 'no' values in the table.
- v-kpoloju-msftCommunity Support
Hi Mera9,
Thank you for your follow up and for clearly explaining the behaviour you're expecting.You're right, the previous logic doesn't filter the table based on the card’s output. To align the table with the card’s logic dynamically, we can use a measure that adapts row level visibility depending on whether "Overdue" values are present in the current filter context.
Revised Dax:Show Row Based on Card = VAR HasOverdue = CALCULATE( COUNTROWS('AUDIT'), 'AUDIT'[Audit] = "Overdue" ) RETURN IF( (HasOverdue > 0 && 'AUDIT'[Audit] = "Overdue") || (HasOverdue = 0 && 'AUDIT'[Audit] <> "Overdue"), 1, 0 )
Drag Show Row Based on Card into the Filters on this visual pane. Set the filter to is = 1.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.