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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Atanas_Atanasov
Helper II
Helper II

Showing Last Selected Month

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:

Atanas_Atanasov_0-1723719421588.png

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

Atanas_Atanasov_1-1723719503973.png

Can you please help me show the last selected month? 

Thank you in advance, 

Atanas

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

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.

 

Jihwan_Kim_1-1723721585724.png

 

 

Jihwan_Kim_0-1723721571661.png

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]
    )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Atanas_Atanasov
Helper II
Helper II

@Jihwan_Kim - Thank you so much!!! It worked like a charm! Take care and stay safe!

Jihwan_Kim
Super User
Super User

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.

 

Jihwan_Kim_1-1723721585724.png

 

 

Jihwan_Kim_0-1723721571661.png

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]
    )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.