Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mahitham
Creator II
Creator II

if logic help

Hi Experts,

Can any one please help me on below if logic to apply Grey Color.

I have a Flag with records 1 and 0.

When $(vCount)/$(vTotalCount))>'20%' and $(Count)>5 and Flag=1,Green(),

When $(vCount)/$(vTotalCount))>'20%' and $(Count)>5 and Flag=0,Red() else its Grey().

Please help me to apply Grey() in the below if logic. 

 

Aggr(

if( ($(vCount)/$(vTotalCount))>'20%' and $(Count)>5 and Prod1Flag=1,Green(),

if( ($(vCount)/$(vTotalCount))>'20%' and $(Count)>5 and Prod1Flag=0,Red())),Prod1Flag,Dim1,Dim2)

 

Thanks in advance

 

 

 

5 Replies
JordyWegman
Partner - Master
Partner - Master

Hi Mahitham,

The problem probably lies in the 20% because you are comparing a value ($(vCount)/$(vTotalCount)) to a string 20%. This is not going to work. I've edited it to 0.2 (also 20%). Try this:

 

Aggr(

if( ($(vCount)/$(vTotalCount))>0.2 and $(Count)>5 and Prod1Flag=1,Green(),

if( ($(vCount)/$(vTotalCount))>0.2 and $(Count)>5 and Prod1Flag=0,Red())),Prod1Flag,Dim1,Dim2)

 

Other question, why do you use the Aggr? 

Jordy

Climber  

Work smarter, not harder
mahitham
Creator II
Creator II
Author

Hi,
still the same issue.
When I haven't used Aggr based on Prod1Flag then Green color or red color is not getting by default. But this Prod1Flag have only 1 or 0 records Grey color wont come under 1 0r 0 thats why i am not to apply grey color.
JordyWegman
Partner - Master
Partner - Master

In which object are you using this? KPI or Table?

Jordy

Climber

Work smarter, not harder
mahitham
Creator II
Creator II
Author

Hi, Thanks for your reply. I am using in Pivot Table.
JordyWegman
Partner - Master
Partner - Master

Hi,

Then I would use the following formula:

if( ($(vCount)/$(vTotalCount))>0.2 and $(Count)>5 and Prod1Flag=1,Green(),
if( ($(vCount)/$(vTotalCount))>0.2 and $(Count)>5 and Prod1Flag=0,Red(),White()))

Jordy

Climber

Work smarter, not harder