Forum Discussion

Vladracs's avatar
Vladracs
Icon for Helper I rankHelper I
3 years ago

Find % growth between 2 rows after filtering a table

Hello Experts,


I have table that is showing me the value of a certain variable for a customer at a given date (table shows year).
noting that this table has been sliced to show a specific month/customer/variable:

I would like to be able to get the variance between each date after filtering these table.

Is that possible in DAX?

 

Thx in advance!

Ex:

YearCustomerVariable_ValueVariance
2018A2 
2019A4100%
2020A650%
2021A3-50%

And if I filter to only 2 years:

YearCustomerVariable_ValueVariance
2018A2 
2021A350%

2 Replies

  • Vladracs , Create a separate date/year table and then have a measure like

     

    //Only year vs Year, not a level below

    This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
    Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
    diff = [This Year]-[Last Year ]
    diff % = divide([This Year]-[Last Year ],[Last Year ])

    Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
    Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
    Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

    • Vladracs's avatar
      Vladracs
      Icon for Helper I rankHelper I

      HI thx for answering, however as I mentioned, I know how to get last year values. that's not what I am aiming here. I need to be able to calculate the diff between 2 values in the table after slicing it. 

      so if the user filter for 2018 and 2022, that is not "last year". But the value should be 2022 value / 2018 value.  if I filter for 2019 and 2021, same thing 2021 / 2019's value.