Forum Discussion

D_PBI's avatar
D_PBI
Icon for Post Partisan rankPost Partisan
1 year ago
Solved

Rolling Total not showing as needed - please help

Hi, I need to create two measures as follows: Measure 1) to show the rolling total up to the last (max) date as specified in the matrix. Measure 2) to show the rolling total for all dates, whether...
  • johnt75's avatar
    1 year ago

    You can try

    Rolling Total Selected Dates =
    VAR MaxDate =
        MAX ( __dimDate[Date] )
    VAR Result =
        CALCULATE (
            [__Number of distinct Agreements],
            USERELATIONSHIP ( __dimDate[Date], agreement[Received Date] ),
            FILTER ( ALLSELECTED ( __dimDate[Date] ), __dimDate[Date] <= MaxDate )
        )
    RETURN
        Result
    

    and 

    Rolling Total All Time =
    VAR MaxDate =
        MAX ( __dimDate[Date] )
    VAR Result =
        CALCULATE (
            [__Number of distinct Agreements],
            USERELATIONSHIP ( __dimDate[Date], agreement[Received Date] ),
            __dimDate[Date] <= MaxDate
        )
    RETURN
        Result
    
  • johnt75's avatar
    johnt75
    1 year ago

    Change measure 1 to be

    Rolling Total Selected Dates =
    VAR MaxDate =
        MAX ( __dimDate[Date] )
    VAR Result =
        CALCULATE (
            [__Number of distinct Agreements],
            USERELATIONSHIP ( __dimDate[Date], agreement[Received Date] ),
            FILTER ( ALLSELECTED ( __dimDate ), __dimDate[Date] <= MaxDate )
        )
    RETURN
        Result

    That is moving the ALLSELECTED from the column to the full table.