Forum Discussion
Conditional Appearance of Text Box?
- 9 years ago
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.
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!
- Anonymous9 years agoNot applicable
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?
- pschommer9 years agoHelper II
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.
- pschommer9 years agoHelper II
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.)