cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
rezaaditia Regular Visitor
Regular Visitor

IF And function more than 2 conditions

Hi -

 

I am trying do if and function with more than 2 condition in DAX which there is limitation on that.

IF DATE([sap_insert_date]) = [Filter Date Validate]
    AND [Validate Po Release Supplier] = "yes"
    AND [Validate Source] = "backlog"
    AND [Validate Po Approval] = "no"
    AND [poa] !=""
    THEN "True"
    ELSE "false"
END

can someone please help me how to achieve this?

 

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
fenchurchio Regular Visitor
Regular Visitor

Re: IF And function more than 2 conditions

You can use && instead of AND, so your code would look something like this.

 

For further reading, here is a link to the DAX operator reference:  https://docs.microsoft.com/en-us/dax/dax-operator-reference

 

Hope this helps.

 

IF DATE([sap_insert_date]) = [Filter Date Validate]
    && [Validate Po Release Supplier] = "yes"
    && [Validate Source] = "backlog"
    && [Validate Po Approval] = "no"
    && [poa] !=""
    THEN "True"
    ELSE "false"
END
fenchurchio Regular Visitor
Regular Visitor

Re: IF And function more than 2 conditions

You can start with something like this:

 

CALCULATE
(
	[Your Measure]
	,FILTER
	(
		'Table'
		,'Table'[sap_insert_date] = MAX([Filter Date Validate])
		&& 'Table'[Validate Po Release Supplier] = "yes"
		&& 'Table'[Validate Source] = "backlog"
		&& 'Table'[Validate Po Approval] = "no"
		&& NOT ISBLANK('Table'[poa])
	)
)
3 REPLIES 3
fenchurchio Regular Visitor
Regular Visitor

Re: IF And function more than 2 conditions

You can use && instead of AND, so your code would look something like this.

 

For further reading, here is a link to the DAX operator reference:  https://docs.microsoft.com/en-us/dax/dax-operator-reference

 

Hope this helps.

 

IF DATE([sap_insert_date]) = [Filter Date Validate]
    && [Validate Po Release Supplier] = "yes"
    && [Validate Source] = "backlog"
    && [Validate Po Approval] = "no"
    && [poa] !=""
    THEN "True"
    ELSE "false"
END
rezaaditia Regular Visitor
Regular Visitor

Re: IF And function more than 2 conditions

thanks @fenchurchio  its working now.

 

next question, if i want to create in measure, can you please teach me again Smiley Happy

 

thanks

fenchurchio Regular Visitor
Regular Visitor

Re: IF And function more than 2 conditions

You can start with something like this:

 

CALCULATE
(
	[Your Measure]
	,FILTER
	(
		'Table'
		,'Table'[sap_insert_date] = MAX([Filter Date Validate])
		&& 'Table'[Validate Po Release Supplier] = "yes"
		&& 'Table'[Validate Source] = "backlog"
		&& 'Table'[Validate Po Approval] = "no"
		&& NOT ISBLANK('Table'[poa])
	)
)

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 105 members 1,323 guests
Please welcome our newest community members: