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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
akowalski
Frequent Visitor

Calculating difference from previous period

Hello,

How can i calculate difference from previous period, when 2 years are selected from slicer. It can be 2017, 2018 but also 2015 and 2018.

I have a list of countries on a column/line chart, every one with values from selected 2 years. I tried DateAdd funcion, but i cannot put there a variable showing a difference in years.

 

If you know better way of showing actual value and a difference from previous period for many countries on a single chart i would love to know it!

Thank you!

1 ACCEPTED SOLUTION
Floriankx
Solution Sage
Solution Sage

Hello,

 

so you want to use slicer to slice for this year and previous year?

 

Ja can differ using Calculate

MeasureMin=
VAR MinSlicedYear=CALCULATE(MIN(DateTable[Year]),ALLSELECTED(DateTable[Year])
RETURN
CALCULATE(Sum(Values),FILTER(FactTable,YEAR([DateColumn)=MinSlicedYear))

MeasureMax is analog.

 

I don't know if this fullfills your purpose exactly but give it a try and let me know.

 

Best regards.

 

View solution in original post

3 REPLIES 3
Floriankx
Solution Sage
Solution Sage

Hello,

 

so you want to use slicer to slice for this year and previous year?

 

Ja can differ using Calculate

MeasureMin=
VAR MinSlicedYear=CALCULATE(MIN(DateTable[Year]),ALLSELECTED(DateTable[Year])
RETURN
CALCULATE(Sum(Values),FILTER(FactTable,YEAR([DateColumn)=MinSlicedYear))

MeasureMax is analog.

 

I don't know if this fullfills your purpose exactly but give it a try and let me know.

 

Best regards.

 

It is working, but only on the drilled up chart. I have countries and years on shared axis and and when im on the lowest level (both year and country) it is not working. I tried to find a way to do this on the lowest leven in hierarchy? Is is at all possible?

Hello,

 

It is hard to tell with knowing so little about your Table structure?

 

Can you provide some dummy data?

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.