cancel
Showing results for
Did you mean: 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

Accepted Solutions Super User IV

@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])``````

Proud to be a Super User!

6 REPLIES 6 Super User IV

@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.

Proud to be a Super User! Helper I

Hi,

Please find the links to the source data, pbix and its exported csv file. Helper I

@amitchandak are you able to access the links? Super User IV

@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])``````

Proud to be a Super User! 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? Helper I

@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? Announcements #### Power Platform Community Conference

Check out the on demand sessions that are available now! #### Power Platform October Community Highlights

Check out the top community contributors across all of the communities #### Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella. Top Solution Authors
Top Kudoed Authors
Users online (2,112)