Forum Discussion
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:
| Year | Customer | Variable_Value | Variance |
| 2018 | A | 2 | |
| 2019 | A | 4 | 100% |
| 2020 | A | 6 | 50% |
| 2021 | A | 3 | -50% |
And if I filter to only 2 years:
| Year | Customer | Variable_Value | Variance |
| 2018 | A | 2 | |
| 2021 | A | 3 | 50% |
2 Replies
- amitchandak
Super User
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
Helper 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.