Forum Discussion
Count Distinct Dates Not working
I thought this would work but I am having a hard time to get the service days graph to work. Esentially I want to be able to count unique service days. It should be anywhere around 16 to 20 days as normally that is how many working days are in a month. I am getting 30 to 40 days? I am picking the month in the hirearchy and then I am distinct counting the days. I thought this makes sense but it must be doing something else. Is it they way its aggregating in the hierarchy that is messing t his up?
My visual
I brought this data source for Janaury and I get 15 days:
9 Replies
- HotChilliCommunity Champion
What is the [Count Days] measure?
- wherdzikHelper III
I tried Chat GPT and it doesnt like the syntax.
VAR temptable = SUMMARIZE ( FILTER ( 'SEP YTD', 'SEP YTD'[Service Date] >= FIRSTDATE('SEP YTD'[Service Date]) && 'SEP YTD'[Service Date] <= LASTDATE('SEP YTD'[Service Date]) ), 'SEP YTD'[Service Date] ) RETURN COUNTROWS ( temptable )
- wherdzikHelper IIICount Days = DISTINCTCOUNTNOBLANK('SEP YTD'[Service Date].[Date])
- HotChilliCommunity Champion
I think you'll just confuse yourself by going to chatgpt.
--
Do you have multiple years in the data?
- wherdzikHelper III
This current data is only Calendar Year
- wherdzikHelper III
Is there anyway someone can help me with this one?
- HotChilliCommunity Champion
Remove the .[Date] part
- wherdzikHelper III
That does not work...same outcome.
- AnonymousNot applicable
Hi wherdzik ,
Try unchecking Automatic Date/Time. Then create and use the [Month] column in the date table as the axis.
= DISTINCTCOUNTNOBLANK('SEP YTD'[Service Date])Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum