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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
admin11
Memorable Member
Memorable Member

How to insert condition to filter salary amount into expression YTD expense ?

Hi All

 

I have this expression , which return YTD total expense amount :- 

_YTD_EXP_ = CALCULATE(CALCULATE(GL[AMOUNT_EXP_],DATESYTD('Date'[Date],"12/31")))
 
The total YTD expense break into 2 expense consist of :-
1_EXP_SALARY_
2. General expense
 
 The 1_EXP_SALARY_ field expression as below :-
 
1_EXP_SALARY_ =
SWITCH(
TRUE(),
'GL'[GL Code] = 81651
|| 'GL'[GL Code] = 80351
|| 'GL'[GL Code] = 80551
|| 'GL'[GL Code] = 91751
|| 'GL'[GL Code] = 90611
, "YES",
BLANK()
)
 
Now i need to insert 1_EXP_SALARY_ into YTD total expression  :-
_YTD_EXP_Salary_ = CALCULATE(CALCULATE(GL[AMOUNT_EXP_],DATESYTD('Date'[Date],"12/31",1_EXP_SALARY_)))
 
Above is not working , hope some one can share with me,
 
Paul
 
 
 
1 ACCEPTED SOLUTION

@amitchandak 

 

Thank you for your sharing. i just got the reply from below post , which is working fine  :-

 

https://community.powerbi.com/t5/Desktop/How-to-insert-condition-into-my-YTD-EXP-expression/m-p/1971...

 

Paul

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@admin11 , Try like

 

_YTD_EXP_ = CALCULATE(GL[AMOUNT_EXP_],DATESYTD('Date'[Date],"12/31"),filter('GL', 'GL'[GL Code] in {81651, 80351,80551,91751,90611}))

 

or


_YTD_EXP_ = CALCULATE(GL[AMOUNT_EXP_],DATESYTD('Date'[Date],"12/31"),1_EXP_SALARY_ = "Yes")

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 

 

Thank you for your sharing. i just got the reply from below post , which is working fine  :-

 

https://community.powerbi.com/t5/Desktop/How-to-insert-condition-into-my-YTD-EXP-expression/m-p/1971...

 

Paul

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.