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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
admin11
Memorable Member
Memorable Member

How to combine 2 expression to display Jul-Sep 21 ?

Hi All

 

Month last -3 =
FORMAT (
DATE ( MAX ( 'Date'[YEAR2] ), MONTH ( TODAY () ) - 3, DAY ( TODAY () ) ),
"mmm-yy")
 
Return :- Jul 21
 
Month last -1 =
FORMAT (
DATE ( MAX ( 'Date'[YEAR2] ), MONTH ( TODAY () ) - 1, DAY ( TODAY () ) ),
"mmm-yy")
 
Return :- Sep 21
 
May i know how to combine above 2 expression into 1 expression , so that it will display Jul-Sep 21 ?
 
Paul
 
2 ACCEPTED SOLUTIONS
mahoneypat
Employee
Employee

Please try this expression instead.

 

MonthRange =
VAR startdate =
    EDATE ( TODAY (), - 3 )
VAR enddate =
    DATE ( MAX ( 'Date'[Year2] )MONTH ( TODAY () ) - 11 )
RETURN
    FORMAT ( startdate"MMM" ) & "-"
        FORMAT ( enddate"MMM yy" )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

You need to change the enddate variable too

 

VAR enddate =
DATE ( MAX ( 'Date'[Year2] ), MONTH ( TODAY () ) - 4, 1 )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

Please try this expression instead.

 

MonthRange =
VAR startdate =
    EDATE ( TODAY (), - 3 )
VAR enddate =
    DATE ( MAX ( 'Date'[Year2] )MONTH ( TODAY () ) - 11 )
RETURN
    FORMAT ( startdate"MMM" ) & "-"
        FORMAT ( enddate"MMM yy" )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat 

Thank you very much , it work . 

i try to do it for April till June 2021 , it does not work.

Qtr Ptrvious=
VAR startdate =
EDATE ( TODAY (), - 6 )
VAR enddate =
DATE ( MAX ( 'Date'[Year2] ), MONTH ( TODAY () ) - 1, 1 )
RETURN
FORMAT ( startdate, "MMM" ) & "-"
& FORMAT ( enddate, "MMM yy" )

 

may i know where go wrong ?

 

Paul

You need to change the enddate variable too

 

VAR enddate =
DATE ( MAX ( 'Date'[Year2] ), MONTH ( TODAY () ) - 4, 1 )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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