Hi ALL,
Basically i want to implement “Display selected Months” Dax code.
The approach is and logic is exactly same as this link -
https://www.sqlbi.com/blog/alberto/2018/12/20/displaying-a-list-of-selected-months/.
The pbix is also available in the link above. And the code used is the new code mentioned in the link itself.
Sel ( much better version ) =
VAR SelectedMonthNumbers =
VALUES ( 'Date'[Month Number] )
VAR MonthsAndNames =
SUMMARIZE ( 'Date' , 'Date'[Month Number] , 'Date'[Month] )
VAR Result =
CONCATENATEX (
MonthsAndNames ,
VAR CurrentMonthNumber = 'Date'[Month Number]
VAR CurrentMonthName = 'Date'[Month]
VAR IsNextSelected = CurrentMonthNumber + 1 IN SelectedMonthNumbers
VAR IsPrevSelected = CurrentMonthNumber - 1 IN SelectedMonthNumbers
RETURN
IF (
NOT ( IsPrevSelected && IsNextSelected ) ,
CurrentMonthName & IF ( IsNextSelected , "-" , ", " )
) ,
"" ,
'Date'[Month Number]
)
RETURN
LEFT ( Result , LEN ( Result ) - 2 )
but the issue i am facing is if i dont select any months it is currently displaying January-December whereas i want to see blank.
thank you…make mark solution done