Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Mauritz_SA
Partner - Specialist
Partner - Specialist

Nested set analysis

Hi everyone

My question is regarding nested set analysis (if that is what you call it). Below is a simplified version of my table (with the rows I want in blue):

 

 CodeStatusInspectionOverdue
A11NoYes
A21NoYes
A31NoNo
A42NoYes
A52NoYes
A63NoNo
A73NoNo
A84YesNo
A94YesYes
A104NoYes

 

My set analysis rules in SQL type logic (mixed with qlik set analysis syntax) are as follows:

Count(codes)

WHERE

Overdue = {"Yes"}

AND

(Status = {"1","2","3"} OR (Status = {"4"} AND Inspection = {"Yes"}))

Which will then return 5 -> (A1, A2, A4, A5, A9)

Currently I have something like this:

COUNT({<Overdue = {"1"},Status = {"1","2","3"}>} Code)

However, I am unsure how I should add the part for OR (Status = {"4"} AND Inspection = {"Yes"})

 

Two comments:

  • This will be used as part of a self service solution so I would like to keep the conditions of the Master Items in the dashboard/front end and not in the load script.
  • I have quite a few conditions so I would like to avoid using something like the following (unless it is the best way of doing it):

COUNT({<Overdue = {"1"},Condition 2, Condition 3, Condition 4, Status = {"1","2","3"}>+<Overdue = {"1"},Condition 2, Condition 3, Condition 4, Status = {"4"},Inspection = {"Yes"}>} Code) 

 

Regards,

Mauritz

Labels (1)
1 Solution

Accepted Solutions
jensmunnichs
Creator III
Creator III

Hey Mauritzsa,

 

This seems to work for me using your sample data:

 

=COUNT(
{
<Overdue={"Yes"}>*
(<Status = {"1", "2", "3"}>+<Status = {"4"}, Inspection = {"Yes"}>)
}
Code)

 

The '*' in the set analysis statement means AND, so any other conditions that should always apply outside the whole OR thing should come after Overdue={"Yes"}. Haven't been able to test this as I don't know your other conditions but I think it works.

 

By the way, I think 'Qlik Community Help Discussions' is for help with the actual forums, for actual help with Qlikview, I think this is where you want to be: https://community.qlik.com/t5/QlikView/ct-p/qlikview

View solution in original post

3 Replies
jensmunnichs
Creator III
Creator III

Hey Mauritzsa,

 

This seems to work for me using your sample data:

 

=COUNT(
{
<Overdue={"Yes"}>*
(<Status = {"1", "2", "3"}>+<Status = {"4"}, Inspection = {"Yes"}>)
}
Code)

 

The '*' in the set analysis statement means AND, so any other conditions that should always apply outside the whole OR thing should come after Overdue={"Yes"}. Haven't been able to test this as I don't know your other conditions but I think it works.

 

By the way, I think 'Qlik Community Help Discussions' is for help with the actual forums, for actual help with Qlikview, I think this is where you want to be: https://community.qlik.com/t5/QlikView/ct-p/qlikview

Mauritz_SA
Partner - Specialist
Partner - Specialist
Author

Hi Jensmunnichs

 

Thank you for the reply, it works! I did not know that you could nest/group conditions using round brackets - very useful. I am still finding my way around the new community, did not realise that you could use the navigation pane on the left to contextualise questions. Thanks for the tip (and the answer to my question).

 

Regards,

Mauritz

jensmunnichs
Creator III
Creator III

Honestly, I didn't know you could do that either, sometimes you just have to try 🙂 And don't worry about posting to the wrong forum, I'm still getting used to this new community too, as I think most people are.