BRIANHINSHAW
3 years agoQrew Member
Multiple IF or Case statement for metric presentation
Have a scorecard where the metric may be a total or an average. Based on that setting, trying to build formula rich text to show the appropriate data.
Got half of it working for Total. How would I expand to support Measurement being an Average or another measurement type?
If([Measurement] ="Total",
If ([2022 Actual YTD] < [2022 Target Low],
Case([Metric Type],
"Currency", "<span style='color: #FF0000'>"&"$"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"M"&"</span>",
"Percent", "<span style='color: #FF0000'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"comma_dot")&"%"&"</span>",
"Number", "<span style='color: #FF0000'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"</span>",
""),
If ([2022 Actual YTD] >= [2022 Target High],
Case([Metric Type],
"Currency", "<span style='color: #228B22'>"&"$"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"M"&"</span>",
"Percent", "<span style='color: #228B22'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"comma_dot")&"%"&"</span>",
"Number", "<span style='color: #FF0000'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"</span>",
""),
//otherwise
"No Actuals"))
)
------------------------------
BRIAN HINSHAW
------------------------------
Got half of it working for Total. How would I expand to support Measurement being an Average or another measurement type?
If([Measurement] ="Total",
If ([2022 Actual YTD] < [2022 Target Low],
Case([Metric Type],
"Currency", "<span style='color: #FF0000'>"&"$"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"M"&"</span>",
"Percent", "<span style='color: #FF0000'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"comma_dot")&"%"&"</span>",
"Number", "<span style='color: #FF0000'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"</span>",
""),
If ([2022 Actual YTD] >= [2022 Target High],
Case([Metric Type],
"Currency", "<span style='color: #228B22'>"&"$"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"M"&"</span>",
"Percent", "<span style='color: #228B22'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"comma_dot")&"%"&"</span>",
"Number", "<span style='color: #FF0000'>"&ToFormattedText(Round([2022 Actual YTD],0.01),"none_dot")&"</span>",
""),
//otherwise
"No Actuals"))
)
------------------------------
BRIAN HINSHAW
------------------------------