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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

how to calculate distinct count

Hello,

 

Usually, we have one invoice number per client or many invoice number for the same client but it may append that a mistake is done and that we have the same invoice number but for two different client.

 

So, if you look at the table below, the invoice 0048131 is repeted 3 times, 2 times for the client UBC PROPERTIES and one time for the client DISTRICT OF PORT EDWARD.

 

So, instead of getting 21 distinct invoice number, we would like to obtain 22 because an invoice number is associated with two different clients.

 

 

I have try 

 

No of distinct invoice=calculate(distinctcount('table'[invoice]), filter(Table[client])) but I have an error message telling that we cannont convert a value of type text to type true and false)

 

Does someone know how to solve this issue?

 

idDescriptionInvoice
1124CITY OF PENTICTON0004060
1028CITY OF PENTICTON0004060
1027UBC PROPERTIES0048131
1122UBC PROPERTIES0048131
1122UBC PROPERTIES0054993
1027UBC PROPERTIES0054993
1027CLINTON & DISTRICT ASSISTED LI0056718
1122CLINTON & DISTRICT ASSISTED LI0056718
1027RF BINNIE AND ASSOCIATES LTD0058534
1122RF BINNIE AND ASSOCIATES LTD0058534
1027VANCOUVER COASTAL HEALTH0059510
1122VANCOUVER COASTAL HEALTH0059510
1027RF BINNIE AND ASSOCIATES LTD0060554
1122RF BINNIE AND ASSOCIATES LTD0060554
1027CLINTON & DISTRICT ASSISTED LI0060564
1122CLINTON & DISTRICT ASSISTED LI0060564
1027VANCOUVER COASTAL HEALTH0060713
1122VANCOUVER COASTAL HEALTH0060713
1027UBC PROPERTIES0062635
1122UBC PROPERTIES0062635
1027VANCOUVER COASTAL HEALTH0062758
1122VANCOUVER COASTAL HEALTH0062758
1122RF BINNIE AND ASSOCIATES LTD0062934
1027RF BINNIE AND ASSOCIATES LTD0062934
1027RF BINNIE AND ASSOCIATES LTD0063278
1122RF BINNIE AND ASSOCIATES LTD0063278
1027CB DEVELOPMENTS0064000
1122CB DEVELOPMENTS0064000
1027UBC PROPERTIES0064322
1122UBC PROPERTIES0064322
1122CB DEVELOPMENTS0064329
1027CB DEVELOPMENTS0064329
1027CITY OF WHITE ROCK0064377
1122CITY OF WHITE ROCK0064377
1027CITY OF CAMROSE0064379
1122CITY OF CAMROSE0064379
1027CITY OF WHITE ROCK0064382
1122CITY OF WHITE ROCK0064382
1027H20 ENTERPRISES INCORPORATED0065497
1122H20 ENTERPRISES INCORPORATED0065497
1123DISTRICT OF PORT EDWARD0896871
1124DISTRICT OF PORT EDWARD0048131
1 ACCEPTED SOLUTION
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

Try this..

 

Measure = SUMX(SUMMARIZE('Table','Table'[Description],"Cnt",DISTINCTCOUNT('Table'[Invoice])),[Cnt])

See below

 

image.png

 

If it helps, mark it as a solution

Kudos are nice too

 

Connect on LinkedIn

View solution in original post

2 REPLIES 2
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

Try this..

 

Measure = SUMX(SUMMARIZE('Table','Table'[Description],"Cnt",DISTINCTCOUNT('Table'[Invoice])),[Cnt])

See below

 

image.png

 

If it helps, mark it as a solution

Kudos are nice too

 

Connect on LinkedIn
Anonymous
Not applicable

I decide to make a new column

CorInvoice = [Invoice] & "|" & [Description]
 
Then I am making a distinctcount in a zummarize table
 
Thanks for you suggestion

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.