Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Distinctcount based on other columns - Measure

Hi Experts

 

I am trying to count the distinct number of values based on two other columns - Country and Explaination - but the distinct count value is wrong.. see measure and sample date

 

Measure

Count (#~) = CALCULATE(DISTINCTCOUNT(pg_control_cases[case_id]),ALL(pg_control_cases[Explanation])) - the result should be 5 but i am getting 4.
 
case_idcreatedCountryExplanation
NONAC-106-33564908317-Nov-23SWEDENUnreasonable compensation
NONAC-106-33564908317-Nov-23SWEDENUnreasonable compensation
NONAC-106-33564908317-Nov-23SWEDENUnreasonable compensation
NONAC-106-33564908317-Nov-23SWEDENUnreasonable compensation
NONAC-106-33564908317-Nov-23SWEDENNeeds further review
NONAC-106-33564908317-Nov-23SWEDENNeeds further review
NONAC-106-33564908317-Nov-23SWEDENNeeds further review
NONAC-106-33564908317-Nov-23SWEDENNeeds further review
AC-019-88133416217-Nov-23SWEDENNo risk identified
AC-019-88133416217-Nov-23SWEDENNo risk identified
AC-012-12753279717-Nov-23SWEDENNo risk identified
AC-012-12753279717-Nov-23SWEDENNo risk identified
AC-416-85648462117-Nov-23SWEDENNo risk identified
AC-416-85648462117-Nov-23SWEDENNo risk identified
1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

7 REPLIES 7
Ahmedx
Super User
Super User

pls try

 

Anonymous
Not applicable

Also tried 

Count (#~) = COUNTROWS(
                DISTINCT(
                    UNION(
                        VALUES(pg_control_cases[case_id]),
                        VALUES(pg_control_cases[Explanation]))))
Anonymous
Not applicable

Why do you expect the result to be 5? There are only 4 unique values in the Case_ID column. Are you double-counting NONAC-106-335649083 because it has 2 Explanations?

Anonymous
Not applicable

Hi Helper 1 there are indeed 4 based on case id when you take into consideration explantation then one id is repeated for repeated Unreasonable compensation and Needs further review then we have 5

Anonymous
Not applicable

kindly try for yourslef with the sample data please.

Anonymous
Not applicable

Hi Ismal - not getting the expect result its just counting the number of rows.

miTutorials
Super User
Super User

Please try the below measure!

 

Measure = COUNTROWS(SUMMARIZE('Table','Table'[case_id],'Table'[Country],'Table'[Explanation]))

 

 

Regards

Ismail

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.