Forum Discussion
Dyanmic Title card help
- 8 years ago
Hello Anonymous,
Xiaoxin,
Thank you for all your help; however I have found a solution to my problem. The snippet of code for the measure I used was
Sample Measure =
VAR Location =
VALUES ( Sheet1[Location] )
VAR sample3 = COUNTROWS ( Location )
VAR NumberOfPossibleLocations =
COUNTROWS ( ALL ( Sheet1[Location] ))
VAR AllButLastSelectedLocation =
TOPN ( NumberOfPossibleLocations - 1, Location )
VAR LastSelectedLocation =
EXCEPT (Location, AllButLastSelectedLocation)
RETURN
"Sample Text 1 Showing results for "
& IF (
sample3= NumberOfPossibleLocations,
"sample text 2 ",
"For "
& IF (
sample3 = 1,
CONCATENATE(VALUES(Sheet1[Location])," This is determinate text and is used for one selection"),
IF(
sample3 =2,
"Select Only one please my guy",
IF(
sample3 = 3,
"Select Only one please my guy X3",
IF(
sample3 = 4,
"Select Only one please my guy X4",
IF(sample3 = 5,
"Select Only one please my guy X5",
"DEFAULT TEXT HERE PLEASE"
)
& LastSelectedLocation
)))))Once again thank you for all your help, your insight was useful in making this information, although I did confirm that the measure did not accept a > sign in places where sample3 = 4 would be, this is also an acceptable solution.
Regards,
Microsoftrookie
HI microsoftrookie,
First, I don't think you can use value range in switch function, '>2' condition may not work.
BTW, slicer can't distinguish all-selected and non-selected, your '=0' part is also invalid.
Maybe you can try to use below formula:
Title Measure=
VAR selected =
SELECTEDVALUE ( Sheet1[Location] )
RETURN
IF (
selected <> BLANK (),
"Displaying Numeric and Percent Change Results for " & selected
& " by Industry Sector(except Total all Industries)",
"Please select only one geography please"
)
Regards,
Xiaoxin Sheng
Hello Anonymous
Thank you for your quick reply Xiaoxin I apperaciate your help and tried out the formula that you had sent me.
I had a similar function with an if statement using the distinctcount function that did the same thing that you posted earlier, though it was a bit sloppier measure that was:
Sample Measure=
IF(DISTINCTCOUNT(Sheet1[Location])=1,"Displaying Numeric and Percentage Change for Industries within " & VALUES(Sheet1[Location]),"Please select one Geography to view Results")
The formula that I am trying to create would allow for a dynamic title of 3 or more scenarios at once(in fact its what I am being asked to create), I thank you for your insight that the range function may not work in a measure it is a big help now that I am aware that measures may be limited in that way.
That being said, I've tried nesting an IF statement within an IF statement with the same logic utilizing the same switch functionality to no avail.
Do you think there may be any other solutions? If not, please let me know and again thank you for your time.
Regards,
Microsoftrookie
- Anonymous8 years agoNot applicable
Hi microsoftrookie,
>>Do you think there may be any other solutions? If not, please let me know and again thank you for your time.
Can you share some sample result which you expect?
Regards,Xiaoxin Sheng
- microsoftrookie8 years ago
Advocate II
Hello Anonymous,
Xiaoxin,
Thank you for all your help; however I have found a solution to my problem. The snippet of code for the measure I used was
Sample Measure =
VAR Location =
VALUES ( Sheet1[Location] )
VAR sample3 = COUNTROWS ( Location )
VAR NumberOfPossibleLocations =
COUNTROWS ( ALL ( Sheet1[Location] ))
VAR AllButLastSelectedLocation =
TOPN ( NumberOfPossibleLocations - 1, Location )
VAR LastSelectedLocation =
EXCEPT (Location, AllButLastSelectedLocation)
RETURN
"Sample Text 1 Showing results for "
& IF (
sample3= NumberOfPossibleLocations,
"sample text 2 ",
"For "
& IF (
sample3 = 1,
CONCATENATE(VALUES(Sheet1[Location])," This is determinate text and is used for one selection"),
IF(
sample3 =2,
"Select Only one please my guy",
IF(
sample3 = 3,
"Select Only one please my guy X3",
IF(
sample3 = 4,
"Select Only one please my guy X4",
IF(sample3 = 5,
"Select Only one please my guy X5",
"DEFAULT TEXT HERE PLEASE"
)
& LastSelectedLocation
)))))Once again thank you for all your help, your insight was useful in making this information, although I did confirm that the measure did not accept a > sign in places where sample3 = 4 would be, this is also an acceptable solution.
Regards,
Microsoftrookie