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
nh27
Helper III
Helper III

Dynamic Measure for Matrix Title based on Selected Month

I have a matrix visual that I would like the title to dynamically change based on the current month selected on the screen.

 

Alternatively if there are no month selections than the title should just show the Previous Month YTD as a title as the data set is in line with this range.

 

I have created a measure :

Previous Month = format(date(year(today()), month(today())-1,1),"MMMM.YY") & " YTD"
My question is how can I change this measure so that if a month is selected on the screen it will show that.
 
E.g. currently it shows June.22 YTD but if I were to select May the title would change to May.22 YTD?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @nh27 ,

I have create a simple sample, please refer to it to see if it helps you.

Please create a measure.

Measure =
VAR Previous_Month =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 )
VAR _value =
    CALCULATE (
        MAX ( Sheet4[value] ),
        FILTER ( ALL ( Sheet4 ), Sheet4[date] = Previous_Month )
    )
VAR _aa =
    CALCULATE (
        MAX ( Sheet4[value] ),
        FILTER ( ALL ( Sheet4 ), Sheet4[date] = SELECTEDVALUE ( 'Table'[Date] ) )
    )
VAR _result =
    IF (
        MAX ( Sheet4[value] ) = _value
            && MAX ( Sheet4[date] ) = Previous_Month,
        _value,
        BLANK ()
    )
VAR __resulttrue =
    IF ( MAX ( Sheet4[date] ) = SELECTEDVALUE ( 'Table'[Date] ), _aa, BLANK () )
RETURN
    IF ( ISFILTERED ( 'Table'[Date] ), __resulttrue, _result )

vpollymsft_0-1657854796849.png

vpollymsft_1-1657854811942.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @nh27 ,

I have create a simple sample, please refer to it to see if it helps you.

Please create a measure.

Measure =
VAR Previous_Month =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 )
VAR _value =
    CALCULATE (
        MAX ( Sheet4[value] ),
        FILTER ( ALL ( Sheet4 ), Sheet4[date] = Previous_Month )
    )
VAR _aa =
    CALCULATE (
        MAX ( Sheet4[value] ),
        FILTER ( ALL ( Sheet4 ), Sheet4[date] = SELECTEDVALUE ( 'Table'[Date] ) )
    )
VAR _result =
    IF (
        MAX ( Sheet4[value] ) = _value
            && MAX ( Sheet4[date] ) = Previous_Month,
        _value,
        BLANK ()
    )
VAR __resulttrue =
    IF ( MAX ( Sheet4[date] ) = SELECTEDVALUE ( 'Table'[Date] ), _aa, BLANK () )
RETURN
    IF ( ISFILTERED ( 'Table'[Date] ), __resulttrue, _result )

vpollymsft_0-1657854796849.png

vpollymsft_1-1657854811942.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

James-Harpin
Resolver IV
Resolver IV

Hi @nh27 

 

I would create a measure

Title = 

SELECTEDVALUE(
'Date'[Month],
[Previous Month]
)
Anonymous
Not applicable

Hi

 

It depends on how you've setup your table, but you can do something with this logic:

 

 

Measure 2 = 
IF(
    DISTINCTCOUNT('Calendar'[Month]) =1,
    MIN('Calendar'[Month]),
    --Place below the option if none is selected
    
    )

 Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

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.

Top Solution Authors