In this workbook, under the Change # sheet, I would like the tooltip to display 2017 and 2022 estimates (separately) when the 2017-2022 range is selected and 2019 and 2024 estimates when the 2019-2024 range is selected. If you hover over the tooltip, you can see how I would like the data to be arranged. Is this possible?
#Tableau Public
not sure what happened to my follow-up post yesterday evening, but its not showing this morning. The following is going to look more confusing to you but I'm a user of regular expressions functions (REGEX) these days when dealing with string (text) based needs.
Calculation3IF MIN([Year Range])='2017-2022' THEN 'The 2017 estimate is: ' +
REGEXP_REPLACE(STR(SUM([2017 Estimate])), '^(-?\d+)(\d{3})$', '$1,$2')
+ ' and the 2022 estimate is: ' +
REGEXP_REPLACE(STR(SUM([2022 Estimate])), '^(-?\d+)(\d{3})$', '$1,$2')
+ ' a difference of ' +
REGEXP_REPLACE(STR(SUM([Difference])), '^(-?\d+)(\d{3})$', '$1,$2')
//When Year Range filter is changed
ELSEIF MIN([Year Range])='2019-2024' THEN 'The 2019 estimate is: ' +
REGEXP_REPLACE(STR(SUM([2019 Estimate])), '^(-?\d+)(\d{3})$', '$1,$2')
+ ' and the 2024 estimate is: ' +
REGEXP_REPLACE(STR(SUM([2024 Estimate])), '^(-?\d+)(\d{3})$', '$1,$2')
+ ' a difference of ' +
REGEXP_REPLACE(STR(SUM([Difference])), '^(-?\d+)(\d{3})$', '$1,$2')
END
Which then returns:
Essentially leveraging the former calculations each of 2019 and 2024 Estimates (and the other two estimate calc's). The REGEX function is looking for 3-digits from the end of the string (text) and if there are only 3-digits then it does nothing. But if the the REGEX detects more than 3-digits, then the parser is supplying a comma (thousands separator) between any digits greater than 3 and the original 3 digits.