cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DaxPadawan
Helper II
Helper II

Year on Year Comparison with a Line Chart

Hello! What I want to do is to plot one year's worth of data vs another year on a line chart. 

 

My data is set up as a Value per Month. So in the Month column you have dates, assigned to the first day of each month (so February 2022 -> 01/02/2022). Value would be a decimal number. 

 

Ideally, I'd like to be able to choose any two specific years to compare, but if that would be too complicated, just choosing one year, and the previous year is automatically displayed, is fine too. 

 

I was thinking I'd have two parameters, where you can select a year, and two measures that select the values based on the parameters. Not sure how to make that work though, I am still confused between the parameters in Power BI and the parameters in Power Query. 

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @DaxPadawan 

Thanks for reaching out to us.

My suggestion is that you can create two separate date tables and put them into different slicers. Alternatively, you can just create a date table and then use measure to get the year before the selected date, the function can use edate() and so on, EDATE function (DAX) - DAX | Microsoft Learn

vxiaotang_0-1672141401882.png

 

 

Best Regards,

Community Support Team _Tang

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

amitchandak
Super User
Super User

@DaxPadawan , I think you need this

Power BI Abstract Thesis: How to use two Date/Period slicers

https://youtu.be/WSeZr_-MiTg

 

 

Other TI can help

 

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

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

Hello @amitchandak! Thank you for this. If I understand correctly, the approach is to to create a separate Date table and use that for one of the slicers?

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.