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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
pbi_newuser2023
Frequent Visitor

How to display 12 months data for current selected year and prior year

Hi, how to plot a line chart with stagnant Jan-Dec month and the lines shows the current year and prior year data like screenshot below?  For example, when user selects year = 2022, then blue line displays % for each month in 2021 and red line blue line displays % for each month in 2021. If user selects year = 2023, then blue line displays % for each month in 2022 and red line blue line displays % for each month (up to latest month) in 2021, like below data we have data up to Apr 2023 only. 

 

pbi_newuser2023_0-1685493323516.png

 

 

DateSales QtyDelivered Qty% Delivered
1/1/2021         289                   3713%
1/2/2021           83                   4757%
1/3/2021         412                   7117%
1/4/2021         281                   4416%
1/5/2021         165                   2213%
1/6/2021         648                   223%
1/7/2021         221                   6329%
1/8/2021         474                   6514%
1/9/2021         660                   132%
1/10/2021         295                   7726%
1/11/2021           68                      69%
1/12/2021           99                   1717%
1/1/2022         979                   929%
1/2/2022         602                   498%
1/3/2022         300                   4816%
1/4/2022         198                   8543%
1/5/2022         555                   7513%
1/6/2022           72                   6387%
1/7/2022         835                   9511%
1/8/2022         112                   4944%
1/9/2022         791                   7710%
1/10/2022         453                   4911%
1/11/2022         647                   7812%
1/12/2022         350                   5616%
1/1/2023         886                 70079%
1/2/2023         337                   3811%
1/3/2023         779                   9512%
1/4/2023           42                   3072%
1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur , how to display only current year (CY) and prior year (PY) based on the year selected? E.g user selects "2023" on "Year" slicer, the chart only shows 2022 and 2023 data from Jan to Dec.

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur , thanks for the solution. It works well but users would like to view the trend of current year and previous year when the month is selected. For example, when users select Month = March, they are still able to see the data from Jan to Dec for previous year and from Jan to Mar for current year. Is that possible? Thanks.

 

pbi_newuser2023_0-1685577977375.png

 

Why the complication???  For the current year, the line chart will only show upto the last month till which there is a date in the Calendar Table. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Yeah, that's the request from users and trying to see if that's possible. Anyway, thanks! 🙂

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.