function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Leonardo WuLeonardo Wu 

How to convert decimals to a percentage in Wave Saql querry reuslt

User-added image
I want to show the reuslt with the percentage, what should I do?
Best Answer chosen by Leonardo Wu
GarryPGarryP
use "trunc" function.
someting like 

<pre>
e = foreach e generate trunc(PUT YOUR EXPRESSION LOGIC AS IN PICTURE HERE);
</pre>

All Answers

GarryPGarryP
use "trunc" function.
someting like 

<pre>
e = foreach e generate trunc(PUT YOUR EXPRESSION LOGIC AS IN PICTURE HERE);
</pre>
This was selected as the best answer
Leonardo WuLeonardo Wu
Hi Girish:
         Thanks for your reply, it's  very helpful. If I want to keep two decimal places , can it be achieved ?
GarryPGarryP
Forgot to add second parameter to trunc function
Use trunc(your_expression,2)

2 is decimal places precision 

Complete documentation 
https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_saql.meta/bi_dev_guide_saql/bi_saql_functions_math.htm
Leonardo WuLeonardo Wu
Hi Girish:
  Thank you so much and your patience. 
  
  I have another question .If I want to  query calculates the growth of sales compared with the previous quarter, do I need add  another Keyword? I follow this example to do ,but i can't to achieve functional.

Example:
User-added image

my action result.  The row 'diff' isn't show on the dashboard.
User-added image
 
GarryPGarryP
Hi Leo,

I wish i could have helped you further, however i do not have explored wave to this extent. I am trying, just in case i got the answer to this onw. I will post.
 
Leonardo WuLeonardo Wu
I have been trying to do this....  But it still can't use row range [-1..-1].   
Leonardo WuLeonardo Wu
Hi Girish:
      I have another new  question .If I want to realize the function of picture, what should I do?User-added image