cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
admin11
Impactful Individual
Impactful Individual

How to insert one condition to my exiting expression PnL_YTD ?

Hi All

 

I have 1 question , hope some one can advise me.

 
I have this expression working fine :- 
PnL_YTD = SUMX('_PnL_Table','_PnL_Table'[Switch_YTD REV&COGS_])
 
I like to add below condition E01 PAYROLL to PnL_YTD expression .
 
E01 PAYROLL =
SWITCH(
TRUE(),
'GL'[GL Code] = 81651
|| 'GL'[GL Code] = 80351
|| 'GL'[GL Code] = 81705
|| 'GL'[GL Code] = 90351
|| 'GL'[GL Code] = 90611
, "YES",
BLANK()
)
 

it should look some thing like below :-

 

PnL_YTD_PAY = if(E01 PAYROLL=YES), SUMX('_PnL_Table','_PnL_Table'[Switch_YTD REV&COGS_])E01

 

But above cannot work.

Paul Yeo

6 REPLIES 6
nvprasad
Solution Specialist
Solution Specialist

Hi admin11,

try appling  E01 PAYROLL=YES filter in sumx like bellow.

SUMX(filter ('_PnL_Table','_PnL_Table'[ E01 PAYROLL] = "Yes"),_PnL_Table'[Switch_YTD REV&COGS_])E01

 

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

 

admin11
Impactful Individual
Impactful Individual

@nvprasad 

 

My E01 PAYROLL field is column field ,  store at GL Table , i am unable see that field GL Table . See below image :-

 

admin11_0-1626764299144.png

 

nvprasad
Solution Specialist
Solution Specialist

Hi,

 

If function you can use only measure as a logic parameter not column.

 

Thank You,

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

 

admin11
Impactful Individual
Impactful Individual

@nvprasad 

Thank you for your reply.

May i know any workaround ?

Paul

 

Hi @admin11 

 

What is the relationship between these two tables?

admin11
Impactful Individual
Impactful Individual

@Vera_33 

Thank you for look into my post.

 

i have create a new post with my simple PBI file on below post :-

 

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

 

Hope you can advise me.

 

Paul

 

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors