Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Kayde_72
Contributor III
Contributor III

Conditional formatting with a data type expression

I have a question about data formatiing with my data types. Each type of data needs to be formatted differently. 

-Revenue ex: $940,928,430

Rate ex: $2.58

-Amount ex: 250,000,945

This is what I currently have but it's an error, not sure how to format the if statement and the formatting for the values. Let me know your thoughts

=if(data_type= "Rev", '$###,###,###',
if(data_type= "Rate", '$##.##',
if(data_type= "Amt", '###,###,###',

)))

Labels (1)
1 Solution

Accepted Solutions
Kayde_72
Contributor III
Contributor III
Author

If someone else has the same question here is how I solved it: 

I had different scenarios and some more formula pieces to add, but this is the finished product with the formatting I wanted

 

if(data_type='Rev', Money(Sum({<scenario={'A'}>}data),'$#,##0'),

if(data_type='Amt', num(sum({<scenario={'A'}>}data),'#,##0'),

num(avg({<scenario={'A'}>}data),'#,##0.00')))

View solution in original post

2 Replies
Or
MVP
MVP

Your error is a result of using double quotes instead of single quotes. It also seems to be missing the Num() function that would tell it you want to format as number:

=num(YourFormulaHere,if(data_type= 'Rev', '$###,###,###',
if(data_type= 'Rate', '$##.##',
if(data_type= 'Amt', '###,###,###',

))))

Kayde_72
Contributor III
Contributor III
Author

If someone else has the same question here is how I solved it: 

I had different scenarios and some more formula pieces to add, but this is the finished product with the formatting I wanted

 

if(data_type='Rev', Money(Sum({<scenario={'A'}>}data),'$#,##0'),

if(data_type='Amt', num(sum({<scenario={'A'}>}data),'#,##0'),

num(avg({<scenario={'A'}>}data),'#,##0.00')))