Forum Discussion

awolf88's avatar
awolf88
Helper II
3 years ago
Solved

Displaying Change in Value by date selection

Dearest community, I'm sure there is a really simple way of doing this, but once again I can't seem to be figuring this out on my own:   I have a very simple table of Open orders by Customer:  ...
  • johnt75's avatar
    3 years ago

    You can create a measure like

    Diff = 
    VAR MinDate = CALCULATE( MIN( 'OpenOrders'[date_archived]), ALLSELECTED(OpenOrders[date_archived]) )
    VAR MaxDate = CALCULATE( MAX('OpenOrders'[date_archived]), ALLSELECTED(OpenOrders[date_archived] ) )
    VAR StartValue = CALCULATE( 
        [total Open Orders], 
        ALLEXCEPT(OpenOrders, OpenOrders[Customer]),
        'OpenOrders'[date_archived] = MinDate
    )
    VAR EndValue = CALCULATE( 
        [total Open Orders], 
        ALLEXCEPT(OpenOrders, OpenOrders[Customer]),
        'OpenOrders'[date_archived] = MaxDate
    )
    RETURN EndValue - StartValue 

    In order to get the matrix to display correctly you need to turn off word wrap for column headings and values and then set the width of the Diff column which appears under the first date to 0.