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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Zael-Leonhart
Helper I
Helper I

Total of Distinct is correct but the displayed values of column is wrong

i have problem in my 2 columns an [area] and [count of companies] in that area.. I put them together in a table, then I added distinct to [count of companies]. Then this happened. the total of the column is correct but the displayed contents of each row of [company] when added manually it doesn't match with the total .. it is usually higher.

 

I would like to get the distinct values of each row when added up that matches with the total of distinct count and would like to make clear the total is correct but the total of each row values when added up will not match the total. I would like to match the row values to the total of distinct [count of company]

 

Can I ask for your kind guidance about this. Thank you.

 

my columns are

[company] [sales] [area] 

 

 

 

1 ACCEPTED SOLUTION

42 REPLIES 42
Ahmedx
Super User
Super User

or try this  Measure

 

 

Ahmedx
Super User
Super User

pls try this

Screenshot_2.png

@Ahmedx Thanks for the reply, I think I somehow get your point here.. but in DirectQuery Countrow wont push through.. not available to directquery.. is there somehow other approach for that? Thanks.

DirectQuery is a complicated thing

Yea, this is for a dynamics 365 field service live dashboard

Zael-Leonhart
Helper I
Helper I

x

Hi @Zael-Leonhart this is a table of results...
Please share a row data to work with..

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

CompanySalesArea
100AREA 2
200AREA 3
400AREA 4
B100AREA 4
B200AREA 4
B400AREA 2
100AREA 4
200AREA 4
400

AREA 2

 

 

 

ZaelLeonhart_0-1701156594141.png

 



@Ritaf1983 the count of company values per row must display the total 6.. not the total 8.. is it possible? thanks in advance..

 

@Zael-Leonhart 

Create a measure with dax :

company_q = DISTINCTCOUNT('Table'[Company])
Ritaf1983_0-1701159981782.png

If this post helps, then please consider Accepting it as the solution to help the other

members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

@Ritaf1983 
as you can see the rows value the sum is not 5.. the expected output is somehow like this..

Area company_qMust be
AREA 2 21
AREA 3 10
AREA 4 44
Total 55

@Zael-Leonhart Again how do you want area 2 to be 1, if there are 2 companies in this area?
A and B

Ritaf1983_0-1701161083371.png

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

@Ritaf1983 oh sorry my bad.. here is my data again

 

ZaelLeonhart_0-1701162042461.png

 

then I've done this

 

 

ZaelLeonhart_3-1701162306063.png

 


output of distinctcount

ZaelLeonhart_2-1701162256974.png

but my desired output is this

ZaelLeonhart_4-1701162364127.png

 

is this possible? thank you

 



 

from your data.. as you can see if you total the values of the row.. is not 5. If possible the values of the rows will equal to the total 5 not 7.. is there any way? thanks 

Row calculates distinct values that are filtered by the specific area...
If you want something else please explain what logic you need.
Because your data has the same company in more than 1 area...

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

@Ritaf1983 Thanks for the reply, hmm the logic.. distinct vs unique.. the logic I want to point is the unique.. I hope you understand what I mean.. 

 

Company Sales Area

A 100 AREA 2 - counted

A 200 AREA 3 - not counted A is already at Area 2

C 400 AREA 4 - counted

B 100 AREA 4 - counted

B 200 AREA 4 - not counted B duplicate

B 400 AREA 2 - not counted have already B

H 100 AREA 4 - counted unique

I 200 AREA 4 - counted unique

J 400 AREA 2 - counted unique

 

 


I don't know if this will help.. if you are familiar with Qlik... i used the expression
sum(aggr(count(distinct [Company]),[Company])). I hope this helps. Thanks

Hi @Zael-Leonhart 
You can rank the company by area and count the first appearances of every company.

Ritaf1983_0-1701229045047.png

Pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other

members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

it looks like were gettting close to it.. 

Company Sales Area

A 100 AREA 2 - counted

A 200 AREA 3 - not counted A is already at Area 2

C 400 AREA 4 - counted

B 100 AREA 4 - counted

B 200 AREA 4 - not counted B duplicate

B 400 AREA 2 - not counted have already B

H 100 AREA 4 - counted unique

I 200 AREA 4 - counted unique

J 400 AREA 2 - counted unique

and the desired output is this

ZaelLeonhart_1-1701231091233.png

 

try this

Screenshot_3.png

@Ahmedx Sorry for the trouble, I'm having issues with the earlier function when I put the company it tells me that incorrect parameter. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.