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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
admin11
Memorable Member
Memorable Member

How to convert my current month expression to get March 2021 Amount ?

Hi All

I have below expression from @amitchandak , which can display April 2021 Amount correctly :-

PnL Apr 21 =
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 ) )
)

admin11_0-1620945472148.png

 

I have below expression , may i know how to convert March 20201 Amount :-

 
Current month - 1 PnL =
VAR _MIN =
EOMONTH ( TODAY (), -4 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -3 )
RETURN
TOTALYTD (
( GL[AMOUNT_1] ),
'Date'[Date],
FILTER ( 'Date', AND ( 'Date'[Date] >= _MIN, 'Date'[Date] <= _MAX ) )
)
 
My PBI file :-
 
Paul Yeo
 
2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

Current month - 1 PnL = 
VAR _MIN =
    EOMONTH ( TODAY (), -3 ) + 1
VAR _MAX =
    EOMONTH ( TODAY (), -2 )
RETURN
    TOTALYTD (
         ( GL[AMOUNT_1] ),
        'Date'[Date],
        FILTER ( 'Date', AND ( 'Date'[Date] >= _MIN, 'Date'[Date] <= _MAX ) )
    )

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

I do not understand your question.  May be someone else will help you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

Current month - 1 PnL = 
VAR _MIN =
    EOMONTH ( TODAY (), -3 ) + 1
VAR _MAX =
    EOMONTH ( TODAY (), -2 )
RETURN
    TOTALYTD (
         ( GL[AMOUNT_1] ),
        'Date'[Date],
        FILTER ( 'Date', AND ( 'Date'[Date] >= _MIN, 'Date'[Date] <= _MAX ) )
    )

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Sorry for my initial post not so clear. I just check and found that your expression is same as Current Month expression. 

Now what i want is i want to get March 2021 Amount , this amount will be there when today date is june 2021. Meaning i need to hard code the expression for March 2021 . 

Some thing like below expression from @amitchandak for April 2021 Amount :-

PnL Apr 21 =
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 ) )
)

 

Paul Yeo

 

How can my expression be the same as the current month expression.  Check again.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur  

I am sorry , You are right , your expression is different from current month :-

But by changing the number , it will not be make the amount stay when next month. the point is i need to create the expression for month of march 2021.

 

ASK :-

Current month - 1 PnL =
VAR _MIN =
EOMONTH ( TODAY (), -3 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -2 )
RETURN
TOTALYTD (
( GL[AMOUNT_1] ),
'Date'[Date],
FILTER ( 'Date', AND ( 'Date'[Date] >= _MIN, 'Date'[Date] <= _MAX ) )
)

 

 

Current month - 1 PnL =
VAR _MIN =
EOMONTH ( TODAY (), -4 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -3 )
RETURN
TOTALYTD (
( GL[AMOUNT_1] ),
'Date'[Date],
FILTER ( 'Date', AND ( 'Date'[Date] >= _MIN, 'Date'[Date] <= _MAX ) )
)

 

Paul

 

Hi,

I do not understand your question.  May be someone else will help you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Thank you very much for info me. 
Also thank a lot for your past support.

 

Paul

@Ashish_Mathur 

it working fine. Thank you very much

Paul

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors