Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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.
Solved! Go to 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])
@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?
@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.
Hi,
Please find the links to the source data, pbix and its exported csv file.
https://drive.google.com/file/d/18maGl1KGtpcvJo4CkEw1faBX6-oY04xR/view?usp=sharing,
https://drive.google.com/file/d/1JN3a26vnrHDvi5CQ_aWs1TaVBImgOFcD/view?usp=sharing,
https://drive.google.com/file/d/1sRgAGmptVyex-4125HpBJ9LG0_MP8TiM/view?usp=sharing
@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])
User | Count |
---|---|
128 | |
109 | |
100 | |
65 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |