I am having trouble with conditional number formatting for parameter variables. I have attempted solutions from the following discussion threads without success:
To simplify - let's say I have two variables, 'PCT_VAR' and 'INT_VAR'. PCT_VAR should be represented as a percentage and INT_VAR should be represented as an integer. I have created a variable, 'vMETRIC', to pass as a parameter.
My Number Format Settings are set to 'Expression Default'. My expression looks like this:
IF(vMETRIC = 'PCT_VAR', NUM(SUM($(vMETRIC)), '#,###.00%'), NUM(SUM($(vMETRIC)), '#,###'))
I have also tried being more explicit with each variable:
IF(vMETRIC= 'PCT_VAR', NUM(SUM($(vMETRIC)), '#,###.00%'),
IF(vMETRIC= 'INT_VAR', NUM(SUM($(vMETRIC)), '#,###')
These fail to format PCT_VAR as a percentage (it shows as a decimal). I would appreciate any help figuring this out!
Note: I cannot attach the workbook, but will create a 'dummy' workbook with the above example if my explanation was not clear enough.
Thanks for the help!
Check this one.
LOAD * INLINE [
PID, Person, Amount, Metric
1, Mary , 123.23, 'PCT_VAR'
1, Collin, 44.33, 'PCT_VAR'
1, Camaro, 443.2, 'INT_VAR'
2, Mary, 99.2, 'INT_VAR'
2, Camaro, 88.99, 'PCT_VAR'
And Chart Expression:
Hi Andrei, thanks for the response. Unfortunately, my data is quite large and has variables transposed across as columns. Something like this:
I create a variable vMETRIC to pass each data column as a parameter into the chart object. This allows the user to switch between INT_VAR and PCT_VAR at will. This data transition works perfectly, but the number formatting does not work in tandem. Any ideas on how this can be accomplished with the above data structure?
If your PCT_VAR already has the % value you can't use sum(PCT_VAR) in your expression.
That way you're making a sum of % which is probably not what you want.
PCT_VAR is a decimal, which results in a percentage after applying the NUM() percent format. I am filtering down to a level in which PCT_VAR is (intentionally) additive.
My question is regarding formatting rather than the variable values themselves. Thanks.
Whether your vMetric could have 'PCT_VAR' and 'INT_VAR'?
If so, it should be ok (in Expression)
Hope this helps.