Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Comparing values to earlier values.

Hello, I'm in a  bit of a pickle and can't figure out how to compare data values. Image for refference. What I would like to do is to compare the names (left) with the values based upon d...
  • v-yulgu-msft's avatar
    8 years ago

    Hi Anonymous,

     

    Please try to add calculated columns with below DAX:

    past =
    LOOKUPVALUE (
        Tb2[Values],
        Tb2[Names], Tb2[Names],
        Tb2[Dates], CALCULATE (
            MAX ( Tb2[Dates] ),
            FILTER ( ALLEXCEPT ( Tb2, Tb2[Names] ), Tb2[Dates] < EARLIER ( Tb2[Dates] ) )
        )
    )
    
    growth =
    IF ( Tb2[past] = BLANK (), 0, ( Tb2[Values] - Tb2[past] ) / Tb2[past] )

     





    And then monthly - however some months dont have data - empty. Is there a way to treat those empty months as 0? And then show current month growth as 0? With the last growth figure by its side - with the last growth date?

    I cannot understand above requirement well, please illustrate your desired result with more details.

     

    Best regards,

    Yuliana Gu