Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Vladracs
Helper I
Helper I

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 2
amitchandak
Super User
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

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.