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 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 Sage
Solution Sage

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

 

@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

 

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

 

@nvprasad 

Thank you for your reply.

May i know any workaround ?

Paul

 

Hi @admin11 

 

What is the relationship between these two tables?

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