Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

IF Statement error

Hi,

I am using the following IF query to show data in a chart expression.

='' & Num(

    Sum([Sales]

          / if((GetFieldSelections(PSF) = 1), [FieldB], 1)

       )

      / if((GetFieldSelections(_BTActiveCurrency) = '$USD'), 1, $(varBTExecSummaryUsdPerGbp))

      /if(GetFieldSelections(_BTUnitOfMeasure) <> 'SQF', 0.09290304, 1)

, if((GetFieldSelections(PSF) = 1), '#,##0.##', '#,##0'))

I want to make some changes and I got confused..

Now if the   (PSF) = 1 it calculate Sum([Sales] / [FieldB]

How can i make it to calculate :

if the (PSF) = 1 then just take [FieldB] as expression otherwisw keep the above method.

Thxs for your help

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Check with it

='' & Num(

    Sum([Sales]

          / if((GetFieldSelections(PSF) = 1), [FieldB],

      if((GetFieldSelections(_BTActiveCurrency) = '$USD'), $(varBTExecSummaryUsdPerGbp,

      if(GetFieldSelections(_BTUnitOfMeasure) <> 'SQF', 0.09290304, 1))), '#,##0.##', '#,##0'))

Can you explain me what your trying to do?

Celambarasan

alec1982
Specialist II
Specialist II
Author

hi,

Thanks for the replay..

on the second and third line of the expression you have

Sum([Sales]

          / if((GetFieldSelections(PSF) = 1), [FieldB],

What i want to do is if the if((GetFieldSelections(PSF) =1 then use FieldB as expression by itself ...

So if it is = 1 I dont need it to calculate Sum(Sales) / by [FieldB]

Regards,

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

='' & Num(

     if((GetFieldSelections(PSF) = 1), [FieldB],

    Sum([Sales])

          /  if((GetFieldSelections(_BTActiveCurrency) = '$USD'), $(varBTExecSummaryUsdPerGbp,

      if(GetFieldSelections(_BTUnitOfMeasure) <> 'SQF', 0.09290304, 1)), '#,##0.##', '#,##0'))

You mean like this?