Forum Discussion

powerbiuser32's avatar
powerbiuser32
Regular Visitor
8 years ago
Solved

Count number of Days In current Month

Hello,   I need a measure to count the number of days in the current month, without the use of any tables etc.  it should show whether this month has either 30, 31, 28 or 29 days. I want to use th...
  • Phil_Seamark's avatar
    8 years ago

    HI Anonymous

     

    You could try

     

    Measure 2 = 
    VAR t = TODAY()
    RETURN  
        COUNTROWS(
            CALENDAR(
                FORMAT(t,"YYYY-MM-01") ,
                EDATE(FORMAT(t,"YYYY-MM-01"),1)-1
               )
        )

    or

     

    Measure 2 = 
    VAR s = FORMAT(TODAY(),"YYYY-MM-01")
    VAR e = EDATE(FORMAT(TODAY(),"YYYY-MM-01"),1)
    RETURN int( e-s)