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
unclejemima
Post Patron
Post Patron

Calculated measure from 2 columns error...ok with 1 variable, just not 2.

Here is my attempted formula...

 

 

Income_55a_HotDrinks = CALCULATE(
	[Income4000'sCalc],
		'Calendar'[IsYesterday] = "True" && Inventry[Size_3] = "Hot")

I can get this calculation to work if there is only one variable (examle, Calendar[isYesterday]

 

 

But as soon as I put 2 variables in it gives me the error...

The expression contains multiple columns, but onl a single column can be used in a true/false expression that is used as a table filter expression.

 

Any suggestions as to what formula I should be using to do this?  Perhaps one with "SEARCH" in it instead?

 

Let me know 😉

 

2 ACCEPTED SOLUTIONS

I assume you have relationship between calendar and inventory tables and the filter you are applying on are columns (not measure)

 

Income_55a_HotDrinks = CALCULATE(
	[Income4000'sCalc],
		'Calendar'[IsYesterday] = "True" ,  Inventry[Size_3] = "Hot")

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

you have && condition with or, what actually you are looking for

 

if you need or then replace && with ||



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Can you post the formula you are trying to build, which throws error?

 

Thanks
Raj

 

Thanks rajendran

 

First I tried this...

 

Income_55a_HotDrinks = CALCULATE(
	[Income4000'sCalc],
		'Calendar'[IsYesterday] = "True" && Inventry[Size_3] = "Hot")

get error.  Then this...(below) and get error.

Income_55a_HotDrinks = CALCULATE(
	[Income4000'sCalc],
		SEARCH("True",'Calendar'[IsYesterday],,blank() 
            && SEARCH("Hot",Inventry[Size_3],,blank())))

What I'm trying to do is, if Calendar[IsYesterday] = "True" AND Inventry[Size_3) = "Hot", then calculate the Income4000'sCalc

 

 

I assume you have relationship between calendar and inventory tables and the filter you are applying on are columns (not measure)

 

Income_55a_HotDrinks = CALCULATE(
	[Income4000'sCalc],
		'Calendar'[IsYesterday] = "True" ,  Inventry[Size_3] = "Hot")

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks parry2k.  That appears to be the answer.  Marked as such 🙂

I came up with another situation I need to an OR in.

 

Income_55a_ColdDrinks_Today = CALCULATE(
[Income4000'sCalc],
'Calendar'[IsToday] = "True" , Inventry[Size_3] = "Ice" OR "Gel")

If Inventry[Size_3] = "Ice" OR "Gel"...how would I go about doing that?

 

My formula does not work.  Suggestions???

This might work???

 

Income_55a_ColdDrinks_Today = CALCULATE(
	[Income4000'sCalc],
		'Calendar'[IsToday] = "True" , OR (Inventry[Size_3] = "Gel", Inventry[Size_3] = "Ice"))

Got this to work...but now if I want 3 OR statements, the IF(Or) does not work.

 

55a_ColdDrink = if(OR(Inventry[Size_3]="Ice",Inventry[Size_3]="Gel"),"Cold","")

Now I want to also add OR Inventry[size_3)= "IceFog" as well...but max arguments for OR in Power BI is 2...

 

help please 😉

you can have multiple OR by using || 

 

55a_ColdDrink = if(Inventry[Size_3]="Ice" || Inventry[Size_3]="Gel" ,"Cold","")


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

55a_ColdDrink = IF(Inventry[Size_3] = "Ice"
    && Inventry[Size_3]="Gel"
    || Inventry[Size_3]="IceFog","Cold",blank())

Using this I'm getting close...but only returns "Cold" for "IceFog", not the "Gel" or "Ice"

 

What am I missing in my formula???

you have && condition with or, what actually you are looking for

 

if you need or then replace && with ||



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

This did it 🙂

 

55a_ColdDrink = IF(Inventry[Size_3] = "Ice"
    || Inventry[Size_3]="Gel"
    || Inventry[Size_3]="IceFog","Cold",blank())

Thank you!!!!

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.