Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error in my Set Analysis syntax,

hi i am experiencing problems with the following

count({$<(inLeveransDatum -Lev_Leveranstid)> Villkor_inlev>} %InLevNr)

it seems to be a syntax error.

what i am trying to do is find the value between two dates (inLeveransDatum  - Lev_Leveranstid and then do a check if they are greater than the actual condition so example 5 days 1 day or 3 days and then count the amount of i

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni


Hi,

Try this expression 

=Sum(Aggr(If((inLeveransDatum - Lev_Leveranstid)> Villkor_inlev, 1, 0), [%InLevNr]))

Regards,

Jagan.

View solution in original post

4 Replies
tresesco
MVP
MVP

Try like:

=Count({<Lev_Leveranstid={"=(inLeveransDatum-Lev_Leveranstid)>Villkor_inlev"}>} DISTINCT Lev_Leveranstid)

Note: DISTINCT you might or might not need.

salto
Specialist II
Specialist II

Hi,

I am afraid that unfortunately you cannot set that calculation directly in the set analysis. You need to save it before (in a field in the script) and use the field in the set analysis expression:

inLeveransDatum -Lev_Leveranstid as NewField;

count({$<NewField= {">= Villkor_inlev"}>} %InLevNr)

Hope this helps.

jagan
Luminary Alumni
Luminary Alumni


Hi,

Try this expression 

=Sum(Aggr(If((inLeveransDatum - Lev_Leveranstid)> Villkor_inlev, 1, 0), [%InLevNr]))

Regards,

Jagan.

Vegar
MVP
MVP

Are you sure you want to do SET? there are alternative ways of solving it. I attach a solution with sum(aggr())

-sum(aggr( ($(vL.Delay)<=(inLeveransDatum-Lev_Leveranstid)),%InLevNr))

-sum(aggr( only(Villkor_inlev)<=(inLeveransDatum-Lev_Leveranstid)),%InLevNr))

Edit: Missed the Villkor_inlev.