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
abloor
Helper IV
Helper IV

Show last calendar month of data

Hi,

 

I have a matrix that I want to filter to show the past calendar month of data. Whilst I have successfully acheived this by adding a relative date slicer, and then hiding it with the selection pane, I was hoping for a different idea that I could put in the visual level filter.  Can anyone suggest how to do this as per the attached image and screenshot?

 

The below dax is a calculated column I tried putting in my calendar table. 
The trouble is is brings me the last month of sales data which is Sep 2020.  What I WANT is past full calendar month just gone (ie June 2019, as it's July 2019 at present).

Maybe there's a word I can put in place of 'max'? Or is there a different suggestion you have?

 

LatestMonth = if ('CalendarDate'[MonthYear] = max('CalendarDate'[MonthYear]), "Yes","No")
 
Thank you!Annotation 2019-07-29 130140.png
1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @abloor 

 

Before trying a calculated column, I would suggest trying a relative date filter as a visual level filter.

You can apply a filter on your Date column similar to below as a visual level filter:image.png

Does that work for you?

Alternatively, you could create a calculated column like:

LatestMonth = 
VAR PreviousMonthYear = LOOKUPVALUE ( 'Date'[MonthYear], 'Date'[Date], EOMONTH( TODAY(), -1 ) )
RETURN
IF (
    'Date'[MonthYear] = PreviousMonthYear,
    "Yes",
    "No"
)

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @abloor 

 

Before trying a calculated column, I would suggest trying a relative date filter as a visual level filter.

You can apply a filter on your Date column similar to below as a visual level filter:image.png

Does that work for you?

Alternatively, you could create a calculated column like:

LatestMonth = 
VAR PreviousMonthYear = LOOKUPVALUE ( 'Date'[MonthYear], 'Date'[Date], EOMONTH( TODAY(), -1 ) )
RETURN
IF (
    'Date'[MonthYear] = PreviousMonthYear,
    "Yes",
    "No"
)

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Thanks @OwenAuger  both of these have worked perfectly. 

I will use the first idea since it's the simplest. (But for anyone reading this, the bottom DAX calc column idea was tested and also suits the job.)

Smiley Very Happy

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.