Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis(using an if statement)

Hi,

Can some1 help me on this, my if statement seems to not be working

(Sum( {$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>} if(vMeasures = 'SepPack','(Qty * SepPack)',$(vMeasures))))

if the measure is = 'SepPack' then the calculation is not correct

Thanks in Advance

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Remove the single quotes around your THEN branch:

Sum(

{$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>}

     if(vMeasures = 'SepPack',

          (Qty * SepPack)                // removed single quotes here, you want the fields, not a literal

          ,$(vMeasures)    

     )

)

View solution in original post

4 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Try with the $ expansion:

(Sum( {$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>} if($(vMeasures) = 'SepPack','(Qty * SepPack)',$(vMeasures))))


let me know

Not applicable
Author

I tried with that but it still doesnt work

swuehl
MVP
MVP

Remove the single quotes around your THEN branch:

Sum(

{$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>}

     if(vMeasures = 'SepPack',

          (Qty * SepPack)                // removed single quotes here, you want the fields, not a literal

          ,$(vMeasures)    

     )

)

Not applicable
Author

Hi,

I removed single quotes  and its working, thanks