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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
DaxPadawan
Helper III
Helper III

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

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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors