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: 
Not applicable

issue in Calulating a value urgent

Hi ,

I am facing an issue .

we have an some target which are defined at weekly level  and  activity are performed to reach that target .

IF we have sum(target)<count(activities performed) then we rae calculating It as hit .

For this I am creating a table using below code

Hit:
load
Week_No,
Month,
Year,
if(sum(Activity_Target)<count(ActivityId) or count(ActivityId)<> 0,1,0 )as HitRate
Resident Activity_Fact
Group by Week_No , Month,Year

But the issue is when both the target and activity is zero it count activity as 1 and put it as hit .

How do I alter the code to remove as  a hit when value for both is 0

1 Reply
Gysbert_Wassenaar

if( alt(sum(Activity_Target)<count(ActivityId),0)<>0 or count(ActivityId)<> 0,1,0 )as HitRate


talk is cheap, supply exceeds demand