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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
gco
Resolver II
Resolver II

Help with filters

Hi there,

 

I have a calendar table that has fulldate (year) and isPastMonth calculated column.

 

IsPastMonth = if Date.Month([#"FullDate"]) < Date.Month(DateTime.LocalNow()) then "Y" else "N"

 

How would i make the IsPastMonth show the past months of the year i selected?  I have a fulldate (year) slicer that currently show 2019 and 2020.

 

Do i have to create another measure of calculated column?

 

Thank you

Glen

1 ACCEPTED SOLUTION

@dax @Anonymous ,

 

I was able to fix my problem by modifying the IsLastMonth calculated column as follows:

 

Old Value:

IsLastMonth = if Date.Month([#"FullDate"]) < (Date.Month(DateTime.LocalNow()) then "Y" else "N"

 

New Value:

IsLastMonth = if (Date.Month([#"FullDate"]) < (Date.Month(DateTime.LocalNow()))) or (Date.Year([#"FullDate"]) < (Date.Year(DateTime.LocalNow())))
then "Y" else "N"

 

This allowed the whole 2019 to be past month and January for 2020.

Thank you

Glen

 

View solution in original post

4 REPLIES 4
dax
Community Support
Community Support

Hi @gco , 

I think you could use filter to achieve this. You could use slicer to filter year, then you could add IsPastMonth in visual or page filter, then choose "Y " in it which will show the past months of your selected year.

575.PNG

Best Regards,
Zoe Zhi

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

I have this on my report, but for some reason, it shows only January for both 2020 and 2019.  I wanted to be able to display the whole months of 2019, and only January for 2020.

 

Thanks

Glen

@dax @Anonymous ,

 

I was able to fix my problem by modifying the IsLastMonth calculated column as follows:

 

Old Value:

IsLastMonth = if Date.Month([#"FullDate"]) < (Date.Month(DateTime.LocalNow()) then "Y" else "N"

 

New Value:

IsLastMonth = if (Date.Month([#"FullDate"]) < (Date.Month(DateTime.LocalNow()))) or (Date.Year([#"FullDate"]) < (Date.Year(DateTime.LocalNow())))
then "Y" else "N"

 

This allowed the whole 2019 to be past month and January for 2020.

Thank you

Glen

 

Anonymous
Not applicable

Hi @gco ,

 

There should not be much else to do.

Depending on an approach you can either add a new column (Year) in the dataset and create a slicer from this column (and Y/N IsPastMonth filter on the visual containing "months") or you can go with grouping FullDates into years - I went with creating a group on the slicer visual binned to years.

 

The key, I guess, is to add the IsPastMonth filter to the either report, page or visual filters (just drag&drop in the filters section and set to "Y").

 

Kind regards,

JB

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.