cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
damonkimble
Frequent Visitor

Power BI DAX Multiple Conditions in a single IF statement[URGENT}

Hi,

I have three variables called:

Append Sales Invoices[Amount] = Type Decimal Number

Append Sales Invoices[Header.No] = Type Text

Append Sales Invoices[Quantity] Type Decimal Number

 

I am trying to customize a column called TSIP Hours where the output is basically Append Sales Invoices[Quantity] that goes through an IF condition.

When the Append Sales Invoices[Amount] is 0 and Append Sales Invoices[Header.No] is either "20144" or "20140" then Output is the Append Sales Invoices[Quantity]. I put the formula down below. The problem is, it's populating the quantity regardless of the If condition - so if the quantity is 1 or greater, it still populates where it should only populate when Amount is 0. 

 

TSIP Hours = IF('Append Sales Invoices'[Amount] = 0 && 'Append Sales Invoices'[Header.No_] = "20144" || "20140", 'Append Sales Invoices'[Quantity])
 
 This formula only populates on the first condition when amount is 0 but doesn't meet the second condition with the &&/||
TSIP Hours = if('Append Sales Invoices'[Amount] = 0 && ('Append Sales Invoices'[Header.No_] = "20144" || "20140"), 'Append Sales Invoices'[Quantity])power bi dax.PNG
1 ACCEPTED SOLUTION
PoojaShri
Resolver II
Resolver II

Hi @damonkimble , you can try the following DAX:
TSIP Hours = IF('Append Sales Invoices'[Amount] = 0 && 'Append Sales Invoices'[Header.No_] = "20144" ||
'Append Sales Invoices'[Header.No_] = "20140", 'Append Sales Invoices'[Quantity], Blank())

Did I solve your problem?

If yes, please mark my solution Accepted!

View solution in original post

3 REPLIES 3
PoojaShri
Resolver II
Resolver II

Hi @damonkimble , you can try the following DAX:
TSIP Hours = IF('Append Sales Invoices'[Amount] = 0 && 'Append Sales Invoices'[Header.No_] = "20144" ||
'Append Sales Invoices'[Header.No_] = "20140", 'Append Sales Invoices'[Quantity], Blank())

Did I solve your problem?

If yes, please mark my solution Accepted!

View solution in original post

Thank you @PoojaShri got this working now! 

Hi @PoojaShri , I have one last question if you can help. So basically similar concept, except Amount has to be >0 and Append Sales Invoices'[Header.No_] IS NOT/Not Equal To   20140, 20141, 20142, 20143. This is what I put but it's not correct: 

 

T+M Hours = IF('Append Sales Invoices'[Amount]>0 && 'Append Sales Invoices'[No_] <> "20144"
|| 'Append Sales Invoices'[Header.No_] <> "20140"
|| 'Append Sales Invoices'[Header.No_] <> "20141"
|| 'Append Sales Invoices'[Header.No_] <> "20142"
|| 'Append Sales Invoices'[Header.No_] <> "20143",
'Append Sales Invoices'[Quantity], Blank())

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors