Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

% Days Complete DAX

Hi,    I want to create a measure that calculates the percentage of days complete in a month.    Ex:   July has 31 days.   Today is 7/19/2018.   19/31 = .612   We are 61% complete with th...
  • v-huizhn-msft's avatar
    8 years ago

    Hi Anonymous,

    Please use the following formula.

    Measure =
    VAR Select_mon =
        SELECTEDVALUE ( Calendario[month] )
    VAR Actual_mon =
        MONTH ( TODAY () )
    RETURN
        SWITCH (
            TRUE (),
            Actual_mon > Select_mon, 1,
            Actual_mon < Select_mon, 0,
            DIVIDE (
                DAY ( TODAY () ),
                CALCULATE (
                    COUNTROWS ( 'Calendar' ),
                    FILTER (
                        ALL ( 'Calendar' ),
                        'Calendar'[Year] = YEAR ( TODAY () )
                            && 'Calendar'[Month Number] = MONTH ( TODAY () )
                    )
                )
            )
        )
    


    Best Regards,
    Angelia