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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
andybamber
Helper III
Helper III

Measure Help

Hello Community!

 

Looking for some help if possible. I have attached a PBIX with a sample file.

 

I have a table of data with customer id (unique) and for each customer id there is a cat name and cat code.

Unfortunately because of the poor nature of the data I have cat names with different cat codes. For instance cat name = A has 2 codes 10000 & 10001

What i am trying to do is calculate the percentage of cat names that have multiple codes.

So for this data set the % should be 57.1%... thats 4 cat names which have multiple codes / 7 distinct cat names

 

PBIX FILE 

 

Cheers

A

3 REPLIES 3
ribisht17
Super User
Super User

@andybamber 

 

Duplicate Cat Codes = ifCALCULATE(COUNT('Table'[Cust_ID]),ALLEXCEPT('Table','Table'[Cat_Name]))>1,1,0)

 

Duplicate Cat Count = CALCULATE(DISTINCTCOUNT('Table'[Cat_Name]),FILTER(all('Table'),[Duplicate Cat Codes]=1))
 
Total Distinct Count of Cats = CALCULATE(DISTINCTCOUNT('Table'[Cat_Name]),all('Table'))
 
Solution = DIVIDE([Duplicate Cat Count],'Table'[Total Distinct Count of Cats])
 
Ans will be 3/7 
 

Regards,

Ritesh

Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

Hi @ribisht17  where does the [Duplicate Cat Codes] from?

 

Cheers

Andy

Sorry to miss that,

ribisht17_0-1656330826766.png

 

STEP 1

Duplicate Cat Codes = ifCALCULATE(COUNT('Table'[Cust_ID]),ALLEXCEPT('Table','Table'[Cat_Name]))>1,1,0)

STEP 2

Duplicate Cat Count = CALCULATE(DISTINCTCOUNT('Table'[Cat_Name]),FILTER(all('Table'),[Duplicate Cat Codes]=1))
STEP 3
Total Distinct Count of Cats = CALCULATE(DISTINCTCOUNT('Table'[Cat_Name]),all('Table'))
STEP 4
Solution = DIVIDE([Duplicate Cat Count],'Table'[Total Distinct Count of Cats])
 
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 
 
 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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