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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
admin11
Memorable Member
Memorable Member

How to modify my existing expression to alway display April 2021 amount ?

Hi All

 

I have below expression working fine , it will display last month PnL amount , that is April 2021 Amount.
Current month - 0 PnL =
VAR _MIN =
EOMONTH ( TODAY (), -2 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -1 )
RETURN
TOTALYTD (
( GL[AMOUNT] ),
'Date'[Date],
FILTER ( 'Date', AND ( 'Date'[Date] >= _MIN, 'Date'[Date] <= _MAX ) )
)

admin11_0-1620893351143.png

Now i like to hard code the April Amount. Can some one share with me how to modify the above expression , so that it will alway display April 2021 amount even during in June 2021.

 

My PBI file :-

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

 

Paul

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @admin11  ,  

 

If you want your expression to always display April 2021, you could modify it as follows:

Current month - 0 PnL2 =
TOTALYTD (
    ( GL[AMOUNT] ),
    'Date'[Date],
    FILTER ( 'Date', EOMONTH ( [Date], 0 ) = EOMONTH ( DATE ( 2021, 04, 01 ), 0 ) )
)

And if it's Mar 2021,you could change DATE (2021,04,01) to DATE (2021,03,01);

if it's Feb 2021, change DATE (2021,04,01) to DATE (2021,02,01);

and so on…

The final output is shown below:  

v-yalanwu-msft_0-1621243760174.png

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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi @admin11  ,  

 

If you want your expression to always display April 2021, you could modify it as follows:

Current month - 0 PnL2 =
TOTALYTD (
    ( GL[AMOUNT] ),
    'Date'[Date],
    FILTER ( 'Date', EOMONTH ( [Date], 0 ) = EOMONTH ( DATE ( 2021, 04, 01 ), 0 ) )
)

And if it's Mar 2021,you could change DATE (2021,04,01) to DATE (2021,03,01);

if it's Feb 2021, change DATE (2021,04,01) to DATE (2021,02,01);

and so on…

The final output is shown below:  

v-yalanwu-msft_0-1621243760174.png

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.  

@v-yalanwu-msft 

Thank you very much for your help , not many people understand what i am trying to said.

amitchandak
Super User
Super User

@admin11 , Try like

 

Current month - 0 PnL =
Var _1 = if(month(today()) >4, month(today()) -4, month(today()) +9)
VAR _MIN =
EOMONTH ( TODAY (), (-1* _1) -1 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), (-1* _1) )
RETURN
TOTALYTD (
( GL[AMOUNT] ),
'Date'[Date],
FILTER ( 'Date', AND ( 'Date'[Date] >= _MIN, 'Date'[Date] <= _MAX ) )
)

 

here +9 can be +8

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak 

it work fine , Thank you very much for your help.

May i know how to modify the expression for Mar 2021 ? i have try play with from -1 to -2 it does not work.

Paul Yeo

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

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