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
Justas4478
Responsive Resident
Responsive Resident

Totals distinct count result instead of normal count

Morning I have this DAX measure:

SKU Count = CALCULATE(COUNTA('Product'[SKU Number]))
I am getting distinct count result in totals even tho I am trying to do normal count:
Justas4478_0-1714726619096.png

Expected total result should be around ~116
As you see in the table it count every sku number but only return distinct in total.
I tried to change DAX multiple times, but I am getting always same totals.
I am not sure how to change it to make it work.
To note: my 'SKU Number' column exist in 'Product' table, other data uses 'Outbound Delivery' table.

Thanks

13 REPLIES 13
v-tangjie-msft
Community Support
Community Support

Hi @Justas4478 ,

 

Thanks @Uzi2019  for the quick reply.

 

By your description, your measure [SKU Count] is displaying the correct count on each row, but the total count is incorrect, right?

You can then create a new measure and place the new measure on the visual object and observe if the totals are correct.

NewMeasure = SUMX(VALUES(Date Table[date]), [SKU Count measure])

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

@v-tangjie-msft Sorry for taking so long to reply, something came up.
I tried your solution and it looked like it is working ok for small sku count, but when I switched back to unfiltered amount of sku that we would be looking at.
It could not give correct results.
Expected row count would be 78704, and result I get is 108358.
I dont know maybe some outside filters are ignored or what other reason could it be.
I as well tried to use different sumx instead of date and results were either lower or higer than expected row count.
I attached sample file as well.
https://we.tl/t-MpfvujM5lj 

Hi @Justas4478 ,

 

Please try to create a new measure.

 

 

 

NewMeasure =
CALCULATE([count measure],ALL('Table'))

 

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

@v-tangjie-msft Morning, I tried your measure:

Total count = CALCULATE('Product'[SKU Count],ALL('Product'))
This is results that I got:
Justas4478_0-1715669259368.png

As you see it is not acting as hoped for.

Uzi2019
Super User
Super User

Hi @Justas4478 

can you share the pbix of sample data in excel??

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

@Uzi2019 Unfortunatelly I cant share pbx file since our data is using live connection model.
I can only share data in the table:
https://we.tl/t-zEZXAWFyBf 
It might be something with realationships between tables that could be causing totals to be distinct or just DAX that I am using.

Hi @Justas4478 
Can try with different measure

 

Count_ = Calculate(Count(SKU Number), Allexcept(date))


Question: How do you know your answer is 116 is it number of dates coming from different table

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Hi @Justas4478 

I think you just have only 4 SKU in product table , correct??
but you have 116 row in Outbound Delivery table ??

 

 Correct me if i am wrong.

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

@Uzi2019 Yes that is correct it is 116 total amount of rows.

Hi @Justas4478 

Instead of counting SKU Number try to count date from Outbound Delivery table.

Or countrow fucntion to count the number of rows in a table.

It might give you 116 as a result.

 

I hope I answered your question!

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

@Uzi2019 I tried counting 'Outbound Delivery' table and this is result I got:

Justas4478_0-1714980390652.png

I tried later as well adding FILTERS in to to calculation but that did not change the result.
The date is not from outbound delivery table it is from 'Date' table that outbound delivery table is connected by date key.

Hi @Justas4478 
so what fileds you have in outbound delivery??? try to take that into count function .

 

I dont know about your modeling that's why asking for pbix. I undertand you have restirction you cant share it.

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

@Uzi2019 These are the fields available in 'Outbound Delivery' table.

Justas4478_0-1714982614101.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.