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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Jackisover
Advocate I
Advocate I

Comparing 2 periods with the choice of the period, on a same graph

Hi, 

 

I would like to be able to compare a data organized by date and zone, with the year before, or the year before that, etc.

I would like to be able to chose the comparison period with a slicer.

 

As you can see on the picture, the orange line is chosen period of 2023. The yellow line is the comparison period of 2021. The 2 lines are in the same graph, and i can compare them. But I could have chosen another year  2020, 2022...

 

But look at my dataset on the 2nd picture : I have only one column date, one column zone and one column volume.  I can't make any changes on the files themselves because there are too many. I want to make it on PowerBI.

 

Please help me I really don't know how to do this

 

Thanks a lot !

 

screen bi.pngscreen data bi.png

7 REPLIES 7
Jackisover
Advocate I
Advocate I

🆙 @Ritaf1983 I'm begging you haha, if you had a little more time for me I'd be so grateful !

Hi @Jackisover 

Sorry , i afraid that i don't know how to help more than i tried 😔

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Jackisover
Advocate I
Advocate I

Thank you @Ritaf1983  but actually I think this solution doesnt work because my date is in my graph, and not only in a slicer

Ritaf1983
Super User
Super User

Hi @Jackisover 
Please refer to the linked tutorial.
It is ok to have 1 column for a date in your fact table, you can work with 2 calendar tables.
https://www.youtube.com/watch?v=40AZos5hjko

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

As I mentioned you need date tables for your model.
The link that i added is a good tutorial.

You can also take a look at my example in the attached pbix to follow i has very similar logic.
I added lines sheet for you. 
Note that the X axis should be just month without year.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hello @Ritaf1983 

I tried to do the same thing on my project, but I seem to have a problem. Actually, I need to display the daily datas, but I can't use the column date on my graph.  So I tried to recreate a new string date, using DAY() and MONTH(). 

The comparison works great, with the slicer, but the basic line doesn't change with its slicer.

I think I'm close but I don't know what to change to get the solution.

 

Could you take a look at my pbix ? Thanks a lot !!

My project 

Thank you very much for your time and your example

I will try this and let you know if it works for me !

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.