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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

How Show Prior months Value

Hello All, 

I have situation where I have to show previous months data in line graph based on month selection in slicer

My table

fiscal year

MonthYearValue_1Value_2Value_3Value_4
2020July201915245432
2020August20195356524
2020September201965698798
2020October20197879678
2020November2019256252458
2020December20193596546354
2020January202024582555465
2020February2020236352532
2020March2020253023712
2020April2020263363214
2020May20206303702718
2020June202068240423100
2021July20207344381820
2021August20207864731358
2021September2020837507869
2021October2020889541375
2021November20209415753595
2021December20209936096935
2021January202110456438715
2021February202110976782572
2021March2021114871265482
2021April202112007462559
2021May20211252780355
2021June2021130481430086

Now I have a slicer for Fiscal Year and Month

slicer

Fiscal Year I have 2020 and 2021(lets say we select 2020)

Month: July 2019 to June 2020(the months are in order July to June)

 

 

Now If I select July in the month Slicer then i have to show only July Month values 

fiscal yearMonthYearValue_1Value_2Value_3Value_4
2020July201915245432

 

Now If I select January  in the month Slicer then i have to show July values to January  

2020July201915245432
2020August20195356524
2020September201965698798
2020October20197879678
2020November2019256252458
2020December20193596546354
2020January202024582555465

 

Can anyone help me with this situation 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous 
You should first have a calendar in the first place. And to get the last n month data, please refer to the solutions in the following posts.

https://stackoverflow.com/questions/49146565/show-last-3-months-from-selected-month-in-power-bi

https://community.powerbi.com/t5/Desktop/DAX-formula-to-return-data-for-last-6-months/td-p/50455

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
  

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Anonymous 
You should first have a calendar in the first place. And to get the last n month data, please refer to the solutions in the following posts.

https://stackoverflow.com/questions/49146565/show-last-3-months-from-selected-month-in-power-bi

https://community.powerbi.com/t5/Desktop/DAX-formula-to-return-data-for-last-6-months/td-p/50455

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
  

amitchandak
Super User
Super User

@Anonymous , you can use datesytd and totalytd they take year-end date. This just for reference where year start and end.

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"6/30"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"6/30"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"6/30"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"6/30"))

Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"6/30"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.