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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to Show Previous Months Values for a selected month and fiscal year

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
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your sample data, I add a MonthNum column in it  and create a calculated columnFYMonthNum ( please refer to https://www.powerobjects.com/blog/2018/12/19/sorting-data-fiscal-year-power-bi/)for sort data in slicer:

 

FYMonthNum = VAR FYStartMonth = 7 RETURN IF ('Table'[MonthNum] >= FYStartMonth,'Table'[MonthNum] -( FYStartMonth-1), 12+('Table'[MonthNum] -(FYStartMonth-1)))

 

 

Capture1.PNG

 

Create a calculated table for slicer (Month) :

 

Table 2 = SUMMARIZE('Table','Table'[Month],'Table'[FYMonthNum])

 

Capture2.PNG

 

Sort the Month column by FYMonthNum column:

 

Capture3.PNG

 

Create a measure and add it to visual level filter:

 

measure = IF(MAX('Table'[FYMonthNum]) <= CALCULATE(VALUES('Table'[FYMonthNum]),FILTER(ALL('Table'),'Table'[Month] = MAX('Table 2'[Month]))),1,0)

 

Capture4.PNG

 

For more details, please refer to the pbix file:  https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ERi8Nqr82KNEiAdQU4n6VzgBp3Yytj0dDbRvLTQTzDIHnw?e=RprmNk

 

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

 

Best Regards,
Dedmon Dai

View solution in original post

1 REPLY 1
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your sample data, I add a MonthNum column in it  and create a calculated columnFYMonthNum ( please refer to https://www.powerobjects.com/blog/2018/12/19/sorting-data-fiscal-year-power-bi/)for sort data in slicer:

 

FYMonthNum = VAR FYStartMonth = 7 RETURN IF ('Table'[MonthNum] >= FYStartMonth,'Table'[MonthNum] -( FYStartMonth-1), 12+('Table'[MonthNum] -(FYStartMonth-1)))

 

 

Capture1.PNG

 

Create a calculated table for slicer (Month) :

 

Table 2 = SUMMARIZE('Table','Table'[Month],'Table'[FYMonthNum])

 

Capture2.PNG

 

Sort the Month column by FYMonthNum column:

 

Capture3.PNG

 

Create a measure and add it to visual level filter:

 

measure = IF(MAX('Table'[FYMonthNum]) <= CALCULATE(VALUES('Table'[FYMonthNum]),FILTER(ALL('Table'),'Table'[Month] = MAX('Table 2'[Month]))),1,0)

 

Capture4.PNG

 

For more details, please refer to the pbix file:  https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ERi8Nqr82KNEiAdQU4n6VzgBp3Yytj0dDbRvLTQTzDIHnw?e=RprmNk

 

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

 

Best Regards,
Dedmon Dai

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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