Forum Discussion
Max Selected Month
I have to create a card to display just the selected month name. My code below insn't working...any recommendations.
Requirements:
If no months are selected, then display blank.
If multiple months are selected, display the max month.
MaxSelectedMonth:=
var SelectedMonth = Format(max('Forecast Calendar'[Month]),"MMM")
return
If (ISBLANK(SelectedMonth),BLANK(),SelectedMonth)
Hi Anonymous,
By my tests, you could modify your fomula like below.
MaxSelectedMonth =
VAR maxselected =
CALCULATE (
MAX ( 'Table1'[Month] )
)
RETURN
IF ( ISFILTERED ( Table1[Month] ), maxselected )You may create another measure by SWITCH to show the Month Name.
MaxSelectedMonth_ = SWITCH ( [MaxSelectedMonth], 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December" )Then create a card visual with MaxSelectedMonth_ measure, you will get the output you expected.
Hope this can help you!:smileywink:
Best Regards,
Cherry
- Anonymous8 years ago
That did not work. I get "Blank" when I click on a Month
MaxSelectedMonth1 =
VAR maxselected =
CALCULATE (
MAX ( 'Forecast Calendar'[Month])
)
RETURN
IF ( ISFILTERED ( 'Forecast Calendar'[Month]), maxselected )SOLVED BY USING
MaxSelectedMonth:= "Bookings " & LOOKUPVALUE(
'Forecast Calendar'[Month Year],
'Forecast Calendar'[Relative Month Index],
[MaxSelectedRelativeMonth]
)
4 Replies
- Zubair_MuhammadCommunity Champion
hi Anonymous
Try this revision
MaxSelectedMonth = VAR SelectedMonth = FORMAT ( MAX ( 'Forecast Calendar'[Month] ), "MMM" ) RETURN IF ( ISFILTERED ( 'Forecast Calendar'[Month] ), SelectedMonth )- Sirhawk3017Helper II
I got a blank on this one as well on the card visual.
- v-piga-msftResident Rockstar
Hi Anonymous,
By my tests, you could modify your fomula like below.
MaxSelectedMonth =
VAR maxselected =
CALCULATE (
MAX ( 'Table1'[Month] )
)
RETURN
IF ( ISFILTERED ( Table1[Month] ), maxselected )You may create another measure by SWITCH to show the Month Name.
MaxSelectedMonth_ = SWITCH ( [MaxSelectedMonth], 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December" )Then create a card visual with MaxSelectedMonth_ measure, you will get the output you expected.
Hope this can help you!:smileywink:
Best Regards,
Cherry
- AnonymousNot applicable
That did not work. I get "Blank" when I click on a Month
MaxSelectedMonth1 =
VAR maxselected =
CALCULATE (
MAX ( 'Forecast Calendar'[Month])
)
RETURN
IF ( ISFILTERED ( 'Forecast Calendar'[Month]), maxselected )SOLVED BY USING
MaxSelectedMonth:= "Bookings " & LOOKUPVALUE(
'Forecast Calendar'[Month Year],
'Forecast Calendar'[Relative Month Index],
[MaxSelectedRelativeMonth]
)