looker-studio

Return a simple COUNT of total days in the current calendar month


As per title - I literally just want to return a COUNT of the number of days in the current month i.e. for June it would be 30 and for July, 31.

I've tried COUNT(DAY OF THE MONTH) and the same with DAY INDEX.

I've no idea where to start.


Solution

  • I'm not sure what your use case is, but to get an estimate for the month of the report, I had to do a CASE for the month, where I put the number of days in each month, and, of course, there's February messing everything up.

    CASE
      WHEN Month Number = 1 THEN '28'
      WHEN Month Number = 3 THEN '30'
      WHEN Month Number = 5 THEN '30'
      WHEN Month Number = 8 THEN '30'
      WHEN Month Number = 10 THEN '30'  
      ELSE '31'
    END