The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Dear All,
I'd like to show the name of the last selected Month And Year when having multiple selections in my slicer.
For example if Janunary, February, March, April, May and June are selected I'd like to show June 2020 on all rows.
I managed to do it with the date column as shown here:
But when I use the Month and Year column in my code I got different result. Instead of having JUN 2020 I got MAY 2020
Can you please help me show the last selected month?
Thank you in advance,
Atanas
Solved! Go to Solution.
Hi,
I think, the reason is because of the sort order column is missed in the measure.
Please try something like below.
I tried to create a sample pbix file like below.
please check the below picture and the attached pbix file.
Selected Period: =
VAR _maxdate =
CALCULATE (
LASTNONBLANK ( dim_calendar[month year sort], [Total orders:] ),
ALLSELECTED ( dim_calendar )
)
RETURN
SELECTCOLUMNS (
FILTER ( ALL ( dim_calendar ), dim_calendar[month year sort] = _maxdate ),
dim_calendar[month year]
)
@Jihwan_Kim - Thank you so much!!! It worked like a charm! Take care and stay safe!
Hi,
I think, the reason is because of the sort order column is missed in the measure.
Please try something like below.
I tried to create a sample pbix file like below.
please check the below picture and the attached pbix file.
Selected Period: =
VAR _maxdate =
CALCULATE (
LASTNONBLANK ( dim_calendar[month year sort], [Total orders:] ),
ALLSELECTED ( dim_calendar )
)
RETURN
SELECTCOLUMNS (
FILTER ( ALL ( dim_calendar ), dim_calendar[month year sort] = _maxdate ),
dim_calendar[month year]
)