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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
zervino
Helper I
Helper I

How to choose and show data comparing two years

I have data with this structure:

 

zervino_1-1698349448440.png

 

And I would like to show this in Power BI:

 

zervino_2-1698349552172.png

 

 

How can I achieve this?

 

The idea is to have some slicers to select the two years to compare (so I could choose 2019 vs 2022 or 2020 vs 2023, etc)

 

1 ACCEPTED SOLUTION
gmsamborn
Super User
Super User

Hi @zervino 

 

Would something like this help?

Compare selected years.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @zervino 

 

You can try the following methods.

In the Power Query-Select the first two columns-Unpivot other column:

vzhangti_0-1698650205699.png

vzhangti_1-1698650229604.png

Measure:

Minyear value = Var _minyear=CALCULATE(MIN('Table'[Year]),ALLSELECTED('Table'[Year]))
Return
CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Year]=_minyear&&[Attribute]=SELECTEDVALUE('Table'[Attribute])))
Maxyear value = Var _maxyear=CALCULATE(Max('Table'[Year]),ALLSELECTED('Table'[Year]))
Return
CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Year]=_maxyear&&[Attribute]=SELECTEDVALUE('Table'[Attribute])))
YOY = [Maxyear value]-[Minyear value]
YOY% = [YOY]/[Maxyear value]

vzhangti_2-1698650623612.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

gmsamborn
Super User
Super User

Hi @zervino 

 

Would something like this help?

Compare selected years.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

Thank you, that works perfect.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors