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 replace 2 GL expense expression into 1 ?

Hi All

 

I have make a post below  :-

https://community.powerbi.com/t5/Desktop/Convert-previous-month-expression-to-last-month-not-working...

 

with the help from  @jdbuchanan71  i get the below expression working fine :-

 

Current month - 1 EXP_ =
VAR _Start = EOMONTH ( TODAY (), -2 ) + 1
VAR _End = EOMONTH ( _Start, 0 )
RETURN
CALCULATE ( [AMOUNT_EXP], DATESBETWEEN ( 'Date'[Date], _Start, _End ) )
 
Current month - 2 EXP_ =
VAR _Start = EOMONTH ( TODAY (), -3 ) + 1
VAR _End = EOMONTH ( _Start, 0 )
RETURN
CALCULATE ( [AMOUNT_EXP], DATESBETWEEN ( 'Date'[Date], _Start, _End ) )
 

May i know how to convert the above expression into 1 , So user need only click on the  :-

month = 2 , get Current month - 1 EXP_ 

month = 1 , get Current month - 2 EXP_ 

 

admin11_0-1616562705663.png

 

Enclosed below is my PBI file :-

https://www.dropbox.com/s/j2vletdewwpeqkj/PBT_V2021_392%20TI_SI_GL%20how%20to%20combine%202%20expres...

 

Paul

 

 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@admin11 , One way is you give him what if parameter and use that -https://docs.microsoft.com/en-us/power-bi/desktop-what-if

 

Current month - 1 EXP_ =
VAR _Start = EOMONTH ( TODAY (), -1 * selectedvalue(Whatif[Value]) -1 ) + 1
VAR _End = EOMONTH ( _Start, 0 )
RETURN
CALCULATE ( [AMOUNT_EXP], DATESBETWEEN ( 'Date'[Date], _Start, _End ) )

 

or you can measure slicer to create button or list

measure slicer
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@admin11 , One way is you give him what if parameter and use that -https://docs.microsoft.com/en-us/power-bi/desktop-what-if

 

Current month - 1 EXP_ =
VAR _Start = EOMONTH ( TODAY (), -1 * selectedvalue(Whatif[Value]) -1 ) + 1
VAR _End = EOMONTH ( _Start, 0 )
RETURN
CALCULATE ( [AMOUNT_EXP], DATESBETWEEN ( 'Date'[Date], _Start, _End ) )

 

or you can measure slicer to create button or list

measure slicer
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

wow your mind work very fast . 

Thank you so much , it work fine.

Paul

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! Prices go up Feb. 11th.

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.

Jan NL Carousel

Fabric Community Update - January 2025

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