Forum Discussion
Countdistinct is not Summing correctly
I've created the below logic (Total Cal Days) to count distinct the number of calendar days and then put the sum of those values as the total. I am exepecting the total to be 32, not 2 (see screenshot). Then I subtract "Total Cal Days" from "Tractor Run Days" to get 11 days "Not Running". I use the same logic to calculate "Tractor Run Days" and it works fine, but it does not work for Total Cal Days. Anything I maybe missing? Thanks for your help
Hi cheid_4838 - You're summarizing the entire CalendarLookup table without any grouping columns. This means it returns a single row, and the count becomes the total number of dates in the current filter context.
try below calculation :
Total Cal Days =
SUMX(
VALUES('YourTable'[GroupColumn]), -- e.g., TractorID
CALCULATE(DISTINCTCOUNT('CalendarLookup'[Date]))
)Hope this works. please check and let know.
4 Replies
- rajendraongole1Super User
Hi cheid_4838 - You're summarizing the entire CalendarLookup table without any grouping columns. This means it returns a single row, and the count becomes the total number of dates in the current filter context.
try below calculation :
Total Cal Days =
SUMX(
VALUES('YourTable'[GroupColumn]), -- e.g., TractorID
CALCULATE(DISTINCTCOUNT('CalendarLookup'[Date]))
)Hope this works. please check and let know.
- v-menakakotaCommunity Support
Hi cheid_4838 ,
Thanks for reaching out to the Microsoft fabric community forum.I would also take a moment to thank rajendraongole1 , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you,
Menaka.- v-menakakotaCommunity Support
Hi cheid_4838 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution so that other community members can find it easily.Best Regards,
Menaka
Community Support Team- v-menakakotaCommunity Support
Hi cheid_4838 ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Best Regards,
Menaka.
Community Support Team