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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
admin11
Memorable Member
Memorable Member

How to modify my expression so that it will display Current Month = Feb 2021 ?

Hi All

Below expression from @amitchandak :-

 

YTD DATE amit =
var _max = MAX('Date'[Date])
var _min = MIN('Date'[Date])
var _a=format(_min, "MMM-YYYY") & " to " & format(_max, "MMM-YYYY") & " SALES BY BRAND_C"
return IF(ISFILTERED('Date'[Date]) || ISFILTERED('Date'[Year]) ,_a,format(TODAY()-2, "MMM-YYYY"))
 
it can display May 2021. i like to change to make it display :-
 
1) Feb 2021. ( Now Display May 2021 is wrong )

2) Current Month = Feb 2021 ( I need to add wording Current Month before Feb 2021 )

 

admin11_0-1620476940180.png

 

My PBI file :-

https://www.dropbox.com/s/zbtghyydwxlnvao/PBT_V2021_400%20GL_TI.pbix?dl=0

 

Paul Yeo

1 ACCEPTED SOLUTION

Hi @admin11 ,

 

Is it like this?

//hardcode
YTD DATE amit =
var _max = MAX('Date'[Date])
var _min = MIN('Date'[Date])
var _a=format(_min, "MMM-YYYY") & " to " & format(_max, "MMM-YYYY") & " SALES BY BRAND_C"
return IF(ISFILTERED('Date'[Date]) || ISFILTERED('Date'[Year]) ,_a,format( DATE(2021,2,1), "MMM-YYYY"))

 

Best regards,
Lionel Chen

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
aj1973
Community Champion
Community Champion

Hi @admin11 

Play with this number eventhough it is not dynamic

aj1973_0-1620483153326.png

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

@aj1973 

Thank you for sharing 

may be my question no so clear . 
actually what I need to hard code the expression , so it will display Feb 2021 amount .  
when I see your expression using Today () - some number , mean the amount will change in june 

Hi @admin11 ,

 

Is it like this?

//hardcode
YTD DATE amit =
var _max = MAX('Date'[Date])
var _min = MIN('Date'[Date])
var _a=format(_min, "MMM-YYYY") & " to " & format(_max, "MMM-YYYY") & " SALES BY BRAND_C"
return IF(ISFILTERED('Date'[Date]) || ISFILTERED('Date'[Year]) ,_a,format( DATE(2021,2,1), "MMM-YYYY"))

 

Best regards,
Lionel Chen

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

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.