Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression - condition

Hi, everybody,

I have an straight table with an expression:

count({$<Kód={'M'},Druh={'VP'},Séria={'04. Nominácie_VÚ'}>}Projekt)

How is the correct syntax for setting condition for showing record only if expression value > 3 ?

Thank you in advance.

Duski

48 Replies
Not applicable
Author

Thank you very much, sunindia,

but my expression is actually by far complicated, as in my example above 😞

---------------------------------------------------------------------------------------------------------------

If(count({$<Kód={'PN'},Druh={'DOD'},Séria={'02. Nominácie_OÚ'},ZdrojDat={'NOM'}>}Projekt)>=3,

(

(sum({$<Kód ={'M'}>} aggr(sum({$<Kód ={'M'},Druh={'VP'},Séria={'02. Nominácie_OÚ'},ZdrojDat={'NOM'}>}Čiastka),

CISLOSTAVBY,Projekt,Séria,Kód,ZdrojDat,Druh,Činnosť,Fáza_RSV))

/

sum({$<Kód ={'PN'}>} aggr(sum({$<Kód ={'PN'},Druh={'VP'},Séria={'02. Nominácie_OÚ'},ZdrojDat={'NOM'}>}-1*Čiastka),

CISLOSTAVBY,Projekt,Séria,Kód,ZdrojDat,Druh,Činnosť,Fáza_RSV))

)*100

-

(sum({$<Kód ={'M'}>} aggr(sum({$<Kód ={'M'},Druh={'DOD'},Séria={'02. Nominácie_OÚ'},ZdrojDat={'NOM'}>}Čiastka),

CISLOSTAVBY,Projekt,Séria,Kód,ZdrojDat,Druh,Činnosť,Fáza_RSV))

/

sum({$<Kód ={'PN'}>} aggr(sum({$<Kód ={'PN'},Druh={'DOD'},Séria={'02. Nominácie_OÚ'},ZdrojDat={'NOM'}>}-1*Čiastka),

CISLOSTAVBY,Projekt,Séria,Kód,ZdrojDat,Druh,Činnosť,Fáza_RSV))

)*100),

0)

--------------------------------------------------------------------------------------------------------------

Can you help me with this ravel ?

Thanx in advance.

Duski

sunny_talwar

I would suggest doing the heavy lifting within the script if possible. By doing that you will simplify your expression, in addition the performance will also increase, because it won't have to go through the if statements.

But with that said, instead of me troubleshooting the formula without knowing what any of this means, I suggest you to share an application with some dummy data and we can help you resolve your issue from there.

Best,

S

wenkew186
Creator
Creator

Hello sunindia & Dusan Vavra,

I have the similar problem, and I checked the Demo of sunindia. that's so close to solved my problem. Because I need segment to the "Sum(Units)". So when I added an 'and' conditional to the IF(),  the 'Total'  will be 0.

like this :  If(Sum(Units) > 50 and Sum(Units) < 90, Sum(Units) , 0)

My Expressions just use 'null()' replace 0.

If(Sum(Units) > 50 and Sum(Units) < 90, Sum(Units) , null() )

l don't know what's the problem? Can you help me?

Thank you very much!

Kevin.

sunny_talwar

Can you share the sample data with the output you want and the output you are getting right now?

Best,

S

wenkew186
Creator
Creator

I have a straight table, 3 Dimension and 5 Expression.

Exp5=Exp1+Exp2+Exp3+Exp4;

4 Button and a variable by Action  Control segment data of Exp5 ;

<>0,  >1<=10,  >10<=26,   >=36;

Exp5=

If(variable='<>0' and Sum(Sales) <>0 ,Sum(Sales),

  if(variable=' >1<=10' and Sum(Sales) >1

       and  Sum(Sales) <=10,Sum(Sales),

   if(variable='  >10<=26' and Sum(Sales) >10

       and  Sum(Sales) <=26,Sum(Sales),

    if(variable=' >=36' and Sum(Sales) >=36

       ,Sum(Sales),null())))

others Exp need have a judgment base on Exp5. order to when Exp is null others need reply null.

Exp4=

if( isnull([Exp5]),0,Exp4);

Exp3=

if( isnull([Exp5]),0,Exp3);

Exp2=

if( isnull([Exp5]),0,Exp2);

Exp1=

if( isnull([Exp5]),0,Exp1);

and then, the I found the 'Total' of the bottom has lose the value when I click the Button to action variable.

hope my describe is clear.

thanks,

Kevin.

     

     

     

     

     

     

     

     

     

     

     

sunny_talwar

I feel that you need to check your if statements differently here. Try something like this:

Exp5=

If(variable <> 0 and Sum(Sales) <> 0 ,Sum(Sales),

  if(variable >1 and variable <=10 and Sum(Sales) >1

       and  Sum(Sales) <=10,Sum(Sales),

   if(variable>10 and variable <= 26 and Sum(Sales) >10

       and  Sum(Sales) <=26,Sum(Sales),

    if(variable >=36 and Sum(Sales) >=36

       ,Sum(Sales),null())))

I hope this helps.

Best,

S

wenkew186
Creator
Creator

may be  my describe has some problem. I make a sample but I don't know how to insert the qvw file.

when click button, the 'Total' of the bottom not display or is not right.

wenkew186
Creator
Creator

please check my sample.

wenkew186
Creator
Creator

Hi sunindia,

if you see my sample? I send again. I have 4 button action a variable vTes1 to control Exp5's value, Exp5 has be segment 4 part.

the problem is the "Total" of bottom in the table has lose or not right when I click the button except  '<>0'.

any suggestion for this?

thanks!!

sunny_talwar

Was out of town... just came back... will look at it right now.

Best,

S