Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello guys! I need a little help.
I searched before posting, but didn't find anything that could help me...
I have the following data:
| Code | Product | Amount |
| 11 | Apple | 1,000 |
| 23 | Apple | 1,250 |
| 34 | Apple | 1,321 |
| 19 | Apple | 1,439 |
| 11 | Apple | 1,250 |
| 11 | Apple | 1,300 |
| 19 | Apple | 1,100 |
| 19 | Apple | 1,986 |
| 34 | Apple | 1,324 |
Based on the above data, I created a metric to sum the AMOUNT column grouped by CODE and got the result below:
| Code | Product | Amount |
| 11 | Apple | 3,550 |
| 23 | Apple | 1,250 |
| 34 | Apple | 2,645 |
| 19 | Apple | 4,525 |
Based on this result I need to display how many CODE I have. In the example above the answer would be four (4), however when I make a metric Power BI does not consider the grouping and returns nine (9) instead of four (4) CODE. Can anyone tell me where I'm going wrong?
I tried to use the functions DAX like Count with distinct and Group by, but without success!
I appreciate who can help me!
Solved! Go to Solution.
Hi,
I am not sure how your desired outcome looks like, but please try to write below measure and put it into the card visualization.
Distinct count measure: =
COUNTROWS ( VALUES ( 'Tablename'[Code] ) )
Hi,
I am not sure how your desired outcome looks like, but please try to write below measure and put it into the card visualization.
Distinct count measure: =
COUNTROWS ( VALUES ( 'Tablename'[Code] ) )
Thank you very much! It worked!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 17 | |
| 9 | |
| 7 | |
| 6 |