Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello Experts,
I have a data like below which is from a database sql query.
I need to use a card to display counts for each code (A,B in this case) in this query.
What is the best approach to display counts on cards?
Do I need to create separate measure for each code and use rowcount with filter using code? Or we have something so that we don't need to create measure for each code (A,B)?
Code,Value,Date
------------------
A, 1, 7/1/2021
A,2, 7/2/2021
B,5,6/1/2021
B,6,7/2/2021
B,7,7/3/2021
Solved! Go to Solution.
Hi, @tina345
Solution1:
Create separate measure for each code and put them to card visual
CountA =
CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Code] = "A" ) )
CountB =
CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Code]="B") )
Solution2:
Put field "Value" to card visual and then change the aggregation from "Sum" to "Count".
Put field "Code" to visual filter pane and select "Basic filtering" to filter data you want.
Please check my sample file for more details.
Best Regards,
Community Support Team _ Eason
Hi, @tina345
Solution1:
Create separate measure for each code and put them to card visual
CountA =
CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Code] = "A" ) )
CountB =
CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Code]="B") )
Solution2:
Put field "Value" to card visual and then change the aggregation from "Sum" to "Count".
Put field "Code" to visual filter pane and select "Basic filtering" to filter data you want.
Please check my sample file for more details.
Best Regards,
Community Support Team _ Eason
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |