Forum Discussion

wherdzik's avatar
wherdzik
Helper III
2 years ago

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

    • wherdzik's avatar
      wherdzik
      Helper 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 )
  • Count Days = DISTINCTCOUNTNOBLANK('SEP YTD'[Service Date].[Date])
  • HotChilli's avatar
    HotChilli
    Community Champion

    I think you'll just confuse yourself by going to chatgpt.

    --

    Do you have multiple years in the data?