Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
Creator II
Creator II

Display String based on conditional Statement.

Hi,

I need to display String 'TRD' based on conditional Statement (If Statement) in table.

My expression is : if(sum(sales)=0,'TRD',sum(sales))

But it shows nothing. How could i display string in Table.

Regards,

Supriya

8 Replies
Chanty4u
MVP
MVP

Hi,

your expression is working for me.

trd.PNG

jayaseelan
Creator III
Creator III

Hi Supriya,

      if(sum(sales)=0,'TRD',sum(sales))  this expression is working fine. I think there is problem on your data. make verify the sum(sales) = 0 is available.

Thanks,

berryandcherry6
Creator II
Creator II
Author

Hi,

Its Strange, if i use simply like that its working, but if i use as below

Num(if(Metrics='Invitations',if(count({$<DateType= {'invitation'},

client_id={'15'}>} invitation_id)=0,'TRD',9)),if(Metrics='Completions Rate','#,##0.0%',if(Metrics='Revenue', '$ #,##0.00')))

It gives me '-' (hyphen). Its because of Using Num. What could i do for this?

jayaseelan
Creator III
Creator III

Except Num conversion  Did you got your desired output? ?

Please upload example qvf file for more clarity.

Chanty4u
MVP
MVP

try to check the  expression in text object. by that  you will get to know where your wrong.

berryandcherry6
Creator II
Creator II
Author

HI,

Here according to my data: if(count({$<DateType= {'invitation'},client_id={'15'}>} invitation_id) = 0

This gives me 'Value' in textbox.

if(count({$<DateType= {'invitation'},client_id={'15'}>} invitation_id)=0,'Value',9)

But this doesnot, It gives empty or blank

Num(if(count({$<DateType= {'invitation'},client_id={'15'}>} invitation_id)=0,'Value',9),'#,##0.0%')

Its because i am applying Num format in my equation

berryandcherry6
Creator II
Creator II
Author

HI,

Yes, Except  Num conversion i am getting desired output

sasiparupudi1
Master III
Master III

The reason for this is you are returning strings as input to the num function.

Num is a formatting function .You can not input format as a number as you are doing in your if conditions

qlik Help->Num( A, '#,##0.0%')    where A=35648.375