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 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
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.