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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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