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: 
helen_pip
Creator III
Creator III

Nested If statement with set analysis not working

Hello

I have written the following statement and although the 2 elements work when seperated, I cannot seem to get it to work together

Could someone kindly cast an eye over my statement and let me know what I am doing wrong

 

=Count(IF(v_Start_Date_ED = v_Min_Date_ED_Calender and v_End_Date_ED = v_Max_Date_ED_Calender1,ID,

COUNT(IF(FactDate>=$(v_Start_Date_ED) and FactDate <= $(v_End_Date_ED), ID))))


Kind Regards

Helen

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

TRy to delete the second nested count

Count(IF(v_Start_Date_ED = v_Min_Date_ED_Calender and v_End_Date_ED = v_Max_Date_ED_Calender1,ID,

(IF(FactDate>=$(v_Start_Date_ED) and FactDate <= $(v_End_Date_ED), ID))))

View solution in original post

6 Replies
alexandros17
Partner - Champion III
Partner - Champion III

TRy to delete the second nested count

Count(IF(v_Start_Date_ED = v_Min_Date_ED_Calender and v_End_Date_ED = v_Max_Date_ED_Calender1,ID,

(IF(FactDate>=$(v_Start_Date_ED) and FactDate <= $(v_End_Date_ED), ID))))

helen_pip
Creator III
Creator III
Author

Hello Alessandro

Hours....I mean hours I have been staring at that statement.....Minutes to resolve...Thank you so much

This works for me now

Thanks

Helen


alexandros17
Partner - Champion III
Partner - Champion III

I'm really happy to have helped you!

Bye

Alexandros

helen_pip
Creator III
Creator III
Author

 

Hello Alexandros

As a victim of your own success, I was wondering if you could kindly help me with the following statement

I have tried applyting the same logic as you helped me wtih before, but this time I am using the Fractile equations and trying to express the answer as a time

Again, both statements work well individually, it is when I have to put the tow statements together, it doesn't work with my master calender

The problem seems to be around the comma between statement 1 and statement 2

=Time(Fractile(If(FactDate>=$(v_Start_Date_ED) and FactDate <=$(v_End_Date_ED), [Total Wait]),0.95)/1440, 'HH:MM',

(IF(FactDate>=$(v_Start_Date_ED) and FactDate <=$(v_End_Date_ED),[Total Wait],0.95)/1440))


Any help or advice would be greatly appreciated

Kind Regards

Helen

alexandros17
Partner - Champion III
Partner - Champion III

The problem is related to unbalanced parenthesis, always start from the inner part:

If(cond1, v1, if(cond2, v2, v3))

then add your function:

Fractile(If(cond1, v1, if(cond2, v2, v3)))

then add your formatting:

Time(Fractile(If(cond1, v1, if(cond2, v2, v3))),'format')

hope it helps

helen_pip
Creator III
Creator III
Author

Thank you for this

Applying this logic has really help me and I shall continue to apply this logic

Thanks again....I think I am alright now

Thanks

Helen