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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
anee123
Helper I
Helper I

Sum of Distinct count is not matching with export data, row by row there is no difference!!!

Hi,

 

Total of distinct count of score id is not matching with export output. Total of count is matching but not total of distinct count.

 

Dax used: I tried sumx and other formulas, still the same result, sum of distinct count is calculated in a different way in Power Bi?

 

2020 data = CALCULATE(DISTINCTCOUNT(Sheet1[Score id]),'Sheet1'[Score_Year] IN { 2020 })

2019 data = CALCULATE(DISTINCTCOUNT(Sheet1[Score id]),'Sheet1'[Score_Year] IN { 2019 })

sumx 2020 = sumx(values(Sheet1[Score id]),CALCULATE(DISTINCTCOUNT(Sheet1[Score id]),Sheet1[Score_Year]=2020))

Sumx 2019 = sumx(values(Sheet1[Score id]),CALCULATE(DISTINCTCOUNT(Sheet1[Score id]),Sheet1[Score_Year]=2019))

 

2020 total distinct count of score id in Power Bi table = 452

2020 total distinct count of score id in export csv = 483

2019 total distinct count of score id in Power Bi table = 266

2019 total distinct count of score id in export csv = 308

 

Can you please let me know if the DAX needs to be tweaked to get the records matching in Power Bi and export.

1 ACCEPTED SOLUTION

@anee123 , because in CSV you are summing up count distinct and while power bi recalculate grand total .

 

This fomula is giving same result

2020 data = 
sumx(SUMMARIZE(Sheet1,Sheet1[Subjects],Sheet1[Institute], Sheet1[COURSE],"_1",CALCULATE(
	DISTINCTCOUNT(Sheet1[Score id]),
	'Sheet1'[Score_Year] IN { 2020 }
)),[_1])

View solution in original post

6 REPLIES 6
anee123
Helper I
Helper I

@amitchandak  Thanks a lot, this worked. I was just curious as to why the previous DAX which i used for distinct count worked for all datasets except this dataset. Any particular reason that distinct count behaves differently with different datasets?

@amitchandak  The formula works, but the performance is impacted hugely, when we have too many slicers and when we do group by on each of the slicer values, the report rendering is too slow. Is ther any alternate work around to improve the performance here?

amitchandak
Super User
Super User

@anee123 , these formulas seem correct. Till Store Id, it will be a distinct count. Post that it will be a SUM.

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

@amitchandak are you able to access the links?

@anee123 , because in CSV you are summing up count distinct and while power bi recalculate grand total .

 

This fomula is giving same result

2020 data = 
sumx(SUMMARIZE(Sheet1,Sheet1[Subjects],Sheet1[Institute], Sheet1[COURSE],"_1",CALCULATE(
	DISTINCTCOUNT(Sheet1[Score id]),
	'Sheet1'[Score_Year] IN { 2020 }
)),[_1])

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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