Skip to main content
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 issue.

I am trying to show the trend in below line chart. On May ,Aug, Oct, Jan and Feb don't have the data so I need to show the value as zero. For that by following below thread wrote the if logics like below . But still not getting 0 values and trend. Looks need to write one common if logic for both. Please help me to modify the expression to get the Trend like expected.

https://community.qlik.com/t5/New-to-Qlik-Sense/IF-LOGIC-HELP/m-p/128134#M28272

Sum(if([Type]='Level1' and Match([Name],'CF','AG','FH'),[Amount]))

/

count(distinct if([Type]='Level1' and Match([Name],'CF','AG','FH'),Issues))

Actual Chart:

Actual Trend.png

Expected:

Trend.png

1 Solution

Accepted Solutions
Channa
Specialist III
Specialist III

may be you getting division/0 or  problem

 

try if count =0 then make as 0 

IF(count(distinct if([Type]='Level1' and Match([Name],'CF','AG','FH'),Issues))>0,

Sum(if([Type]='Level1' and Match([Name],'CF','AG','FH'),[Amount]))/

count(distinct if([Type]='Level1' and Match([Name],'CF','AG','FH'),Issues)),0)

 

 

Channa

View solution in original post

3 Replies
Channa
Specialist III
Specialist III

=if(Match([Name],'CF','AG','FH') and [Type]='Level1' ,sum([Amount]),0)

try

Channa
mahitham
Creator II
Creator II
Author

Hi @Channa 

I have tried the above expression. But its not working.

By trying the Numerator expression as sperate and denominator expression as sperate charts getting correct trend. But while using the whole expression in one chart the 0 values trend is missing.

Please help me to modify these expressions.

Thanks in advance

line chart.png

Channa
Specialist III
Specialist III

may be you getting division/0 or  problem

 

try if count =0 then make as 0 

IF(count(distinct if([Type]='Level1' and Match([Name],'CF','AG','FH'),Issues))>0,

Sum(if([Type]='Level1' and Match([Name],'CF','AG','FH'),[Amount]))/

count(distinct if([Type]='Level1' and Match([Name],'CF','AG','FH'),Issues)),0)

 

 

Channa