Controlling the number of decimal places for a string "number"

Due to data privacy, I am required to show asterisks (****) when a metric is under a certain group size. As a result, I need to transform my numbers into a string.

The issue is the decimal places that are show in the final table. Because I transform the number into a string, I need to specify the number of characters I want left. If I say 4 characters, I will either get 12.3% or 4.80%, which visually isnt great for my users. Is there any way to just show 12.3% and 4.8%, i.e. the tenth decimal place?

ifelse(sum(ifelse({month_end_date}<=${Month End},{Group 1 HC},0)) >= 4 , concat(coalesce(left(toString(round(sum(ifelse( {month_end_date}<=${Month End},{Group 1 HC},0))/max(ifelse({month_end_date}<=${Month End},{Total HC},0)) * 100,1)),4), β€˜0.0’), β€˜%’) , β€˜****’ )

Hi @clintave

you could check the number of decimal places and cut before the concat or if the string is already finish find the 2nd decimal and do a concat(left(),right()).

BR

Thanks Erik!

So within the formula, I do use a left function, which is how I determine the 4 character count.

Is it possible to see how many characters are before or after a decimal in Quicksight? If yes, I could use an ifelse statement to use the left vs. right based on those results.

You could use locate() any check the position of the dot.

1 Like

Hi @clintave, did this solution work for you? I am marking this reply as, β€œSolution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community!