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
djcau
Regular Visitor

Display Current and Previous Months

Hi Guys,

 

Would just like to look for some help in dashboard.

 

I am trying to create a chart/report wherein whenever i select a specific yearmonth in a slicer, I will still be able to see the previous months in the chart/report within the fiscal year.

 

Example:

If I select "December 2018" in the slicer,

My table/chart should still show and their equivalent results.

July

August

September

October

November

December

 

 

Thank you

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @djcau,

 

Here I made an sample based on you description. You can refer to the following steps to meet your requirement.

 

1. Enter a list of date and create some calculated columns using the formulas as below.

 

yyyymm = FORMAT('date'[date],"mmmm yyyy")
Year = YEAR('date'[date])

2. Create a date table and create a calcualed column based on the date table.

 

Table = CALENDARAUTO()
YM = FORMAT('Table'[Date],"mmmm yyyy")

3. New a measure using the formula as below.

 

Measure = IF(MAX('date'[date])<=MAXX(ALLSELECTED('Table'),'Table'[Date]) && MAX('date'[Year])=MAXX(ALLSELECTED('Table'),YEAR('Table'[Date])),1,0)

Then we can get the result as we excepted. Here we should use the YM column as a slicer.

 

Capture.PNG

 

Please notice here the relationship between date table and fact table is inactive, for more details, please check the pbix as attached.

 

https://www.dropbox.com/s/wihx4i5bwuihkdd/Display%20Current%20and%20Previous%20Months.pbix?dl=0

 

Regards,

Frank

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @djcau,

 

Here I made an sample based on you description. You can refer to the following steps to meet your requirement.

 

1. Enter a list of date and create some calculated columns using the formulas as below.

 

yyyymm = FORMAT('date'[date],"mmmm yyyy")
Year = YEAR('date'[date])

2. Create a date table and create a calcualed column based on the date table.

 

Table = CALENDARAUTO()
YM = FORMAT('Table'[Date],"mmmm yyyy")

3. New a measure using the formula as below.

 

Measure = IF(MAX('date'[date])<=MAXX(ALLSELECTED('Table'),'Table'[Date]) && MAX('date'[Year])=MAXX(ALLSELECTED('Table'),YEAR('Table'[Date])),1,0)

Then we can get the result as we excepted. Here we should use the YM column as a slicer.

 

Capture.PNG

 

Please notice here the relationship between date table and fact table is inactive, for more details, please check the pbix as attached.

 

https://www.dropbox.com/s/wihx4i5bwuihkdd/Display%20Current%20and%20Previous%20Months.pbix?dl=0

 

Regards,

Frank

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @djcau,

 

Does that make sense? If so, kindly mark my answer as a solution to close the case.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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.

Top Solution Authors
Top Kudoed Authors