Forum Discussion

Noivilbo's avatar
Noivilbo
Frequent Visitor
7 years ago
Solved

Measure on different columns

Hi,    I'm making calculations for a business that has a rather recurring revenue model. So I'm trying to calculate the last sale per client, to show the evolution of the underlying revenue base. ...
  • v-cherch-msft's avatar
    7 years ago

    Hi Noivilbo 

    You may create below two measures:

    LastAmountSum =
    VAR Lase_date =
        CALCULATE (
            MAX ( Salestable[Date] ),
            FILTER ( ALL ( Datetable ), Datetable[Date] < MAX ( Salestable[Date] ) )
        )
    RETURN
        CALCULATE (
            SUM ( Salestable[Amount] ),
            FILTER ( ALL ( Datetable ), Datetable[Date] = Lase_date )
        )
            + CALCULATE ( SUM ( Salestable[Amount] ) )
    
    Measure =
    VAR Max_date =
        CALCULATE (
            MAX ( Salestable[Date] ),
            FILTER ( ALL ( Salestable ), Salestable[Date] <= MAX ( Datetable[Date] ) )
        )
    RETURN
        SUMX (
            FILTER ( ALL ( Datetable ), Datetable[Date] = Max_date ),
            [LastAmountSum]
        )
    

    Regards,

  • v-cherch-msft's avatar
    v-cherch-msft
    7 years ago

    Hi Noivilbo 

    You may check the attached sample file.The formula are measures.If it is not your case,please update the sample data(add the third client) and explain more about how to get your expected output.

    Regards,