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
Syndicate_Admin
Administrator
Administrator

Always select the page-level filter for the previous completed month

Hello Team,

I want page-level filter that will auomate the selection month process which is the previous completed month.

for example, the current month is May 2020.

But I want page-level filter that can select April 2020 whenever the data udpates.

righ now I have manual selection of year and month.

date.PNG

Best regards

Aditya Vighne

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

Hi @Syndicate_Admin 

I think you want to show values in Previous month.

You can build a unrelated calendar table , build a slicer by this calendar table and create a filter measure for your visual.

I build a sample table with values from 2020/01/01 to 2020/06/30.

Calendar Table:

Calendar = 
ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]),"MonthName",FORMAT([Date],"MMMM"))

Measure:

Measure = 
VAR _CurrentlastDay = MAX('Calendar'[Date])
VAR _PreviousStart = EOMONTH(_CurrentlastDay,-2)+1
VAR _PreviousEnd = EOMONTH(_CurrentlastDay,-1)
Return
IF(AND(MAX('Sample'[Date])>=_PreviousStart,MAX(Sample[Date])<=_PreviousEnd),1,0)

Add this measure into filter field in your visual and set this measure to show item when value =1.

2.png

Result is as below.

By default your visual will show blank.

1.png

Select 2020 May as current Month, visual will return values in previous month 2020 April.

3.png

Best Regards,

Rico Zhou

 

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

Hi @Syndicate_Admin 

I think you want to show values in Previous month.

You can build a unrelated calendar table , build a slicer by this calendar table and create a filter measure for your visual.

I build a sample table with values from 2020/01/01 to 2020/06/30.

Calendar Table:

Calendar = 
ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]),"MonthName",FORMAT([Date],"MMMM"))

Measure:

Measure = 
VAR _CurrentlastDay = MAX('Calendar'[Date])
VAR _PreviousStart = EOMONTH(_CurrentlastDay,-2)+1
VAR _PreviousEnd = EOMONTH(_CurrentlastDay,-1)
Return
IF(AND(MAX('Sample'[Date])>=_PreviousStart,MAX(Sample[Date])<=_PreviousEnd),1,0)

Add this measure into filter field in your visual and set this measure to show item when value =1.

2.png

Result is as below.

By default your visual will show blank.

1.png

Select 2020 May as current Month, visual will return values in previous month 2020 April.

3.png

Best Regards,

Rico Zhou

 

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

@Syndicate_Admin , Create a new column in you date table and select Last Month and save

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)

 

 

Or do this for both year and month

 

Year Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Selected Year" ,
Format([Date],"YYYY")
)

 

Mon Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Selected Month" ,
Format([Date],"mmmm")
)

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.