Forum Discussion

Nihed's avatar
Nihed
Helper III
4 years ago
Solved

Need help dax

Hello,   I need your help quickly please I wanted to do the calculation of the next measurement and I did not find the right formula dax ๐Ÿ˜• The formula and the following : Open Missions Calculat...
  • v-kkf-msft's avatar
    4 years ago

    Hi Nihed ,

     

    Please try the following formula:

     

    Measure = 
    VAR NowQua =
        YEAR ( TODAY () ) & " Q" & QUARTER ( TODAY () )
    VAR CurrentMonth =
        IF (
            SELECTEDVALUE ( 'Calendar'[Quarter] ) = NowQua,
            FORMAT ( TODAY (), "yyyymm" ),
            MAX ( 'Calendar'[YearMonth] )
        )
    VAR EndDate =
        CALCULATE (
            MAX ( 'Calendar'[Date] ),
            'Calendar'[YearMonth] = CurrentMonth,
            ALL ( 'Calendar' )
        )
    VAR StartDate = EndDate - 42
    RETURN
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                'Table'[End Date] <= StartDate
                    && (
                        'Table'[Approved / Settled Date] >= EndDate
                            || 'Table'[Approved / Settled Date] = BLANK ()
                    )
            )
        )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.