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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
CMccown
Helper I
Helper I

Display latest month in card when data exists in visual

I have a the following visual that is correct for the current year:

 

CMccown_0-1659655732993.png

 

However when I choose 2021 for year the month card does not display December:

CMccown_1-1659655849273.png

 

I realize that the measure calculating the last month needs to be filtered for year as well but I'm not sure what I need to include in order to do that.

 

The measure I created for the month is as follows:  MaxMonth = (Format(Date(1, Month(MAX('DailyWeather'[Date])),1),"MMMM"))

 

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

@amitchandak - thank you for providing these options! The solution to my particular problem was solved with a much simpler solution. I created a measure that found the last date for the year subject to the filter and formatted it to reflect the month in text: 

 

Latest_Month = (Format(Date(1, Month(Lastdate(DailyWeather[Date])),1),"MMMM"))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@CMccown , In below you have few option var

 

var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , eomonth(today(),0) )

 

var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , maxx(allselected(Table), Table[Date])  )

 

replace var _max as per need

 

MTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

This Month =
var _max = eomonth(if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),0)
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

 

Last Month =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = eomonth(_max1,-1)
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

@amitchandak - thank you for providing these options! The solution to my particular problem was solved with a much simpler solution. I created a measure that found the last date for the year subject to the filter and formatted it to reflect the month in text: 

 

Latest_Month = (Format(Date(1, Month(Lastdate(DailyWeather[Date])),1),"MMMM"))

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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