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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
admin11
Memorable Member
Memorable Member

How to make my card display 2019 when i click year = 2019 ?

Hi All

 
Now i have below expression working fine , it will display April 2021.
 
Month Last =
FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),"mmm-yyyy")
 
May i know how to change the above expression , so that when i click on year=2018 , the card will display 2018 ?
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @admin11  , 

 

You could  change YEAR(TODAY()) to the value of the slicer,Here can use MAX() ,as follows:

_Month last =
FORMAT (
    DATE ( MAX ( 'Date'[YEAR2] ), MONTH ( TODAY () ) - 1, DAY ( TODAY () ) ),
    "mmm-yyyy")

The final output is shown below:

v-yalanwu-msft_0-1621936314322.jpegv-yalanwu-msft_1-1621936314323.jpeg

 

Best Regards,
Community Support Team_ Yalan Wu
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
v-yalanwu-msft
Community Support
Community Support

Hi @admin11  , 

 

You could  change YEAR(TODAY()) to the value of the slicer,Here can use MAX() ,as follows:

_Month last =
FORMAT (
    DATE ( MAX ( 'Date'[YEAR2] ), MONTH ( TODAY () ) - 1, DAY ( TODAY () ) ),
    "mmm-yyyy")

The final output is shown below:

v-yalanwu-msft_0-1621936314322.jpegv-yalanwu-msft_1-1621936314323.jpeg

 

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

Fowmy
Super User
Super User

@admin11 

Try

Month Last =

FORMAT(
    DATE(
        YEAR( SELECTEDVALUE(DATE[YEAR])),
        MONTH(TODAY())-1,
        DAY(TODAY()))
    ,
    "mmm-yyyy"
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

admin11
Memorable Member
Memorable Member

@Fowmy 

i use your expression , when i select year = 2017 , but it display 1905

admin11_0-1621776843980.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.