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
In my data set I need to take a count or distinct count of a unqiue ID depending on a column value. In the below example, if the Value is A or C I need to take a count of the Unique ID and if the Value is B I need to take a distinct count. The Expected Result is what I would need the data to be represented as in a single visualization. Any help would be greatly appreciated as I keep going in circles.
| Data Example | |||
| Value | ID | Unique ID | Count Type |
| A | 12345 | A12345 | Count |
| A | 12345 | A12345 | |
| A | 12345 | A12345 | |
| B | 13579 | B13579 | Distinct |
| B | 13579 | B13579 | |
| B | 54321 | B54321 | |
| B | 54321 | B54321 | |
| B | 97531 | B97531 | |
| C | 11223 | C11223 | Count |
| C | 99887 | C99887 |
| Expected Result | |
| Value | Total |
| A | 3 |
| B | 3 |
| C | 2 |
Solved! Go to Solution.
Hi @Anonymous ,
I took what you provided and was able to tweak it a little to get what I needed. Here is where I ended up at when creating the measure. Thanks for the assistance.
Hi @Anonymous
Use matrix chart instead of table chart
Or
Create is as a column instead of measure.
Hi @Anonymous ,
I took what you provided and was able to tweak it a little to get what I needed. Here is where I ended up at when creating the measure. Thanks for the assistance.
HI @Anonymous
You can try
_count =
Switch(TRUE(),
'A',COUNT(COL),
'B',DISTINCTCOUNT(COL),
'C',COUNT(COL))
Hi @Anonymous ,
I am able to create a measure with the formula suggested, but when adding the measure to a visual I receive the following error "Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values."
Regards,
Eric
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 73 | |
| 50 | |
| 46 | |
| 44 |