Reputation: 496
I have a visual in power bi that uses html to display text from a specific calculated column named "Answer". This data set has a specific question and answer for each row of data, and each row is associated with a specific state. When a user selects a state from the slicer, they are shown all Answers for that state (multiple rows of data). What I want is a way for this visual to say "Please select a state" until a state has been selected. Since I need it to return several rows from a calculated column, I can't seem to get a measure to work.
Sample of data
State | Question | Answer |
---|---|---|
GA | What is the state bird? | Brown Thrasher |
GA | What is the state flower? | Cherokee rose |
NY | What is the state bird? | Eastern Bluebird |
NY | What is the state flower? | Rose |
FL | What is the state song? | Swanee River by Stephen Foster |
This is the current formula for the calculated column "Answer":
Answer = "<div style =""margin: 5px 12px 2px 2px;""><p style=""background-color:rgb(238,238,238);"">
<span style=""color:rgb(134, 17, 6);font-family:segoe ui;font-size:14pt;"">"
&'Wage & Hour - FP Site Map (PBI)'[Question]&"</p>"
&mid('Wage & Hour - FP Site Map (PBI)'[LongAnswer],60,LEN('Wage & Hour - FP Site Map (PBI)'[LongAnswer]))
I previously tried adding HASONEFILTER to the front of the Answer formula, but since calculated columns don't update after load it didn't adjust as a user selected/deselected.
Anyone know of a way to have a calculated column default to "Please select a state" until a state selection is made? Do I need to make supporting measures, or a summary table of some sort?
And thank you for taking the time to take a look -- any advice is deeply appreciated!
Upvotes: 0
Views: 244
Reputation: 40204
A measure can certainly detect if multiple states are selected.
For example,
AnswerText =
IF (
HASONEVALUE ( TableName[State] ),
VALUES ( TableName[State] ),
"Please select a state."
)
Upvotes: 1