Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

how to calculate cumulative decrease use DAX

Hi, experts, I want to get the gap of the relevant value, for example, the "cal" column in the picture, do you have any solutions?

 

  • VAR PreviousRow = CALCULATE( [Orders], OFFSET( -1, ALLSELECTED('Product'[yearmonth]), ORDERBY('Product'[yearmonth], ASC) ) )
    RETURN [# Orders] - PreviousRow


    Hello Anonymous ,
    I hope this helpful for you if not so can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

5 Replies

  • VAR PreviousRow = CALCULATE( [Orders], OFFSET( -1, ALLSELECTED('Product'[yearmonth]), ORDERBY('Product'[yearmonth], ASC) ) )
    RETURN [# Orders] - PreviousRow


    Hello Anonymous ,
    I hope this helpful for you if not so can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks, I am not quiet understand [# Orders] of "RETURN [# Orders] " , can you tell me what it stands for? Thanks.

    • sivasrao's avatar
      sivasrao
      Icon for Helper III rankHelper III

      Hi,

      What is the [Order] in the above function?