Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We'd like to customize many of the bar and line charts in our app so that we display label values to two decimal places of accuracy, but adjust axis values so that they do not display decimal values when viewing percentage values, and displaying the % sign.
I can't find any way to accomplish this, but I'm not sure if that is because it's not possible, or because I can't figure out how to do it.
Has anyone successfully done so? If so, how?
Consider this made up example
[test_data]:
LOAD * INLINE [
id, name, value, year
1, apple, .164, 2020
2, apple, .1852, 2019
3, apple, .15, 2018
];
in measure use dual
something like
dual(measureexpression_formatted_with_decimal, measureexpression_formatted_without_decimal)
put number formatting as measure expression
Hi
Try by setting the measure number format to auto
Thanks
in measure use dual
something like
dual(measureexpression_formatted_with_decimal, measureexpression_formatted_without_decimal)
put number formatting as measure expression
Thanks @Kashyap_R - I updated the post to reflect that the values are meant to be percentages, and I want to display the values as percentages, with the percentage sign.
Setting the measure number format to auto doesn't work in this case.
Hi
Try this as @dplr-rn suggested
dual(Num(Percentage,'##.#0')&'%', (percentage)) as measure
and Change the format as measure expression
Hope this helps
Thanks
Thanks @dplr-rn - your solution worked, though it's a bit unwieldy. It would be nice to be able to control the formatting of the value labels and axis separately.
For anyone having a similar issue down the road, this is the formula I ended up using (in conjunction with setting Number formatting to measure expression.
dual((Round(Sum(value) * 100, .01)) & '%', Sum(value) * 100)