Round Function Alternative

Hi, I have a question regarding decimal places in Domo. It seems that the built in Domo formatting options are designed to truncate, v.s. the MYSQL function ROUND. I would like to have some consistency with how my cards looks and I have a specific example where I need to use Truncate(which does not exist as a MYSQL function in my instance). EX: I am using a beastmode to display percentages concatenated with words so I cannot use the built in formatting options

As you can see in the screenshot when using ROUND function it rounds the value to display as 10% however when using the built in formatting options it displays as 10.0%. This is how I want it to display using a beastmode. If there is a workaround please help.

Thank you,




Answers

  • Hi @Matt_Umolac93

    You can use the ROUND function to specify the number of decimal places you want in your resulting value.

    ROUND(`Percentage`, 1)
    

    This would get you one decimal place. By default if you don't have the second argument it defaults to 0.

    If you're wanting to truncate you can use the FLOOR method to drop everything after the decimal place.

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Hi Grant,

    I am using the function as you describe above(Round(Percentage,1), however it is rounding 10.0% to display as 10%. I would like a way to display it as 10.0% percent also, the FLOOR method you describe does not seem like it would allow it to display as 10.0% either? Correct me if I am wrong.

    Thanks

  • If you look at the raw data is it showing 10 or 10.0? Are you able to click on the field in the card, select format - percentage and then set the percentage decimals to 1? What type of card are you utilizing to display your 10%?

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Hi, the it is a calculated field with a numerator and a denominator to give me the percentage so it should show as 10.0%. I cannot use the built in formatting options in this case because I am concatenating it with text and using it as a summary number beastmode. I am using it as the summary number in a bar chart.

  • If it's returning the string value of 10.0% then it shouldn't be doing any formatting. When you select it in your column list in analyzer is it listed under dimensions (blue) or metrics (green)?

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • It is a beastmode and it is blue. It seems to happen only when the number after the decimal place is 0. Another example is 24.03%. If I use round(24.03%,1) to get 1 decimal place it rounds it to be 24% not 24.0%.