Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
MishaM
Contributor II
Contributor II

Is there an expression that will allow me to show different data types (percentages and whole numbers) in the same column in a Qlik Sense Table?

Is there an expression that will allow me to show different data types (percentages and whole numbers) in the same column in a Qlik Sense Table?  If so, could someone provide the syntax for that? I'm a bit of a novice at scripting.

 

The column is called "Actual - Previous Week". There are 12 values in the column. Four of the values are whole numbers and the other 8 are percentages.

Any help would be greatly appreciated.

Thank you!

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

On the front end, you could use e.g.

num(Sum(YourField),If(SomeDimension='Somevalue','#,##0', '#,##0%'))

Using the if() function inside the num() function to pick the format.

View solution in original post

3 Replies
Or
MVP
MVP

On the front end, you could use e.g.

num(Sum(YourField),If(SomeDimension='Somevalue','#,##0', '#,##0%'))

Using the if() function inside the num() function to pick the format.

MishaM
Contributor II
Contributor II
Author

Thank you, @Or! That worked. I tweaked it a little bit to make it work specifically for my numbers. I ended up using the following script:

 

=num(([Actual - Previous Week]),If([Measure Name] = 'Cumulative Total of Applications' or [Measure Name] = 'Gates' or [Measure Name] = 'Cumulative Average','#,###', '#,###.##%'))

 

*Follow-up question: The script made all of the measures mentioned above whole numbers except for the last one, Cumulative Average. Can you see anything wrong with the script that caused the last one not to convert to a whole number?

 

Thanks again!

Or
MVP
MVP

Without seeing the formula and input, I can't really guess as to why that might happen. However, if you'd like to convert values to a whole number (rather than display them without a decimal point), consider using Floor() or Round().