Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
irnm8dn
Post Prodigy
Post Prodigy

Conditional Appearance of Text Box?

I have build a product pricing tool in Power BI that requires our representative to select a series of options in a slicer to prduce a cost and unit count.  Because each product has its nuances, is it possible to have a text box appear/disappear when a specific item is selected from a slicer?  If so, how?

 

Thanks in advance!

1 ACCEPTED SOLUTION

I was on a mission and couldn't stop. The following will account for multiple selections. Given our individual handling of the fruit, I chose to give the same message whether zero or multiple selections were made.

 

Warning Message = IF(AND(ISFILTERED(tblFruit[Name]),HASONEVALUE(tblFruit[Name])),IF(OR(VALUES(tblFruit[Name])="Apples",OR(VALUES(tblFruit[Name])="Grapes",VALUES(tblFruit[Name])="Pears")),"Wash " & VALUES(tblFruit[Name]) & " before eating.",""),"PICK ONE FRUIT!")

 

BOLD is still new from the original.

IF the fruit has been filtered and IF there is only 1 fruit value, go ahead and put up a message. Otherwise (zero or multiple selected), tell the user to make a SINGLE selection.

View solution in original post

14 REPLIES 14
vanessafvg
Super User
Super User

@irnm8dn can you give more information, like what you want to do with the text box, display information?  based on what?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Within the Slicer, the representative has to pick a product.  As an example, Apples or Oranges.

 

When the representative picks apples, I would like a text box that appears "Recommend to customer to wash apples before earting."

 

Conversely, if the representative picks Oranges in the slicer, no text box would appear.

 

Thanks!

@irnm8dn 

 

check out this youtube video

 

https://www.youtube.com/watch?v=UcsL5rpTCvw





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




This is absolutelty what I am looking to do, but I am struggling with the DAX statement.  Using my example can you construct the DAX for me to follow the argument?

Something like this should do the trick:

 

Warning Message = IF(VALUES(tblFruit[Name])="Apples","Wash apples before eating.","")

 

"Warning Message" is a measure.

tblFruit is the table name.

[Name] is the field name containing the name of the fruit.

 

Add this measure to a card.

If the user selects "Apples" from the slicer, the card populates with "Wash apples...". If anything else is selected, null is displayed in the card - it looks blank.

This does not work if more than one fruit is chosen in the slicer.

The description of what I am looking for is exact.  However, when I apply the DAX logic - I am getting a message that says...

 

Too many arguments were passed to the VALUES function.  The maximum argument count for the function is 1.

 

Any thoughts?

Hopefully, it's just a syntax error. Maybe missing a parenthesis?

Can you paste the definition for your new measure?

Not trying to be coy by disguising some info below.

 

Thanks again for the help.

 

SNip.PNG

The first right parenthesis should be after the right square bracket, not at the end.

 

Like this:

Message = IF(VALUES('Master Rate Date'[Product])="something","something else")

@pschommer

 

You possess Harry Potter like wizardry.

 

One last quesition...

 

Is there any way NOT to have what appears to be a broken tile show when the product is not selected?

 

SNip.PNG

Since you said LAST QUESTION, I took another quick look.

 

If you wrap the existing defintion in another IF statement checking first to see whether the fruit name is filtered, that works for me. It's getting a little long now, but here is what it looks like:

 

Warning Message = IF(ISFILTERED(tblFruit[Name]),IF(OR(VALUES(tblFruit[Name])="Apples",OR(VALUES(tblFruit[Name])="Grapes",VALUES(tblFruit[Name])="Pears")),"Wash " & VALUES(tblFruit[Name]) & " before eating.",""),"PICK A FRUIT!")

 

The new part is BOLD. We're saying, "If the slicer is filtered, go ahead and figure out which message to put up." If nothing is selected, yell at the user. You may want to change that last message, but I prefer the direct approach.

 

It still doesn't work with multiple selections, but you said no more questions... Smiley Happy

I was on a mission and couldn't stop. The following will account for multiple selections. Given our individual handling of the fruit, I chose to give the same message whether zero or multiple selections were made.

 

Warning Message = IF(AND(ISFILTERED(tblFruit[Name]),HASONEVALUE(tblFruit[Name])),IF(OR(VALUES(tblFruit[Name])="Apples",OR(VALUES(tblFruit[Name])="Grapes",VALUES(tblFruit[Name])="Pears")),"Wash " & VALUES(tblFruit[Name]) & " before eating.",""),"PICK ONE FRUIT!")

 

BOLD is still new from the original.

IF the fruit has been filtered and IF there is only 1 fruit value, go ahead and put up a message. Otherwise (zero or multiple selected), tell the user to make a SINGLE selection.

Awesome!  Thanks for all the help, it is greatly appreciated.

A little fancier - to capture and identify each of the washable fruit - would be something like this:

 

Warning Message = IF(OR(VALUES(tblFruit[Name])="Apples",OR(VALUES(tblFruit[Name])="Grapes",VALUES(tblFruit[Name])="Pears")),"Wash " & VALUES(tblFruit[Name]) & " before eating.","")

 

(Unlike Excel, you can only put 2 arguments in an OR statement, but you can nest them within eachother. Since we have 3 washable fruits, I nested the 2nd and 3rd fruit values in their own OR statement.)

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.