Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sersal10
Creator
Creator

how to include an easy condition of a variable lower than another in a set analysis

Hi all,

I need to include a test in a set analysis. The expression that is not in bold works fine. I just need to include a condition now, i.e I need to sum the sales when  weeks_left_to_event was a smaller number than current_weeks_left_to_event

=Rangesum(Above(Sum({<year_event=, weeks_left_to_event<={"current_weeks_left_to_event"} ,month_event=, event_code=p(previous_event_code), event_to_compare=, event_name= >} quantity), 0, RowNo()))

Any help much appreciated!!

Labels (3)
1 Solution

Accepted Solutions
marcus_sommer

Your implementation within the above rangesum() of:

weeks_left_to_event<={"current_weeks_left_to_event"} 

isn't correct but your second one of:

days_left_to_event = {"<=$(=current_days_left_to_event)"}

is syntactically ok. If there is an error it's from another part or the content of the fields/variables. 

Beside this you may not get the wanted results with such approach if the comparing needs to happens on a row-level. In this case you will need an if-loop like:

if(weeks_left_to_event <= current_weeks_left_to_event, sum(...)) 

View solution in original post

4 Replies
sersal10
Creator
Creator
Author

I am trying this one but there is a sintaxis error in the modifier set expression:


days_left_to_event = {"<=$(=current_days_left_to_event)"}

Chanty4u
MVP
MVP

Try this 

=Rangesum(Above(Sum({<year_event=, weeks_left_to_event<current_weeks_left_to_event, month_event=, event_code=p(previous_event_code), event_to_compare=, event_name= >} quantity), 0, RowNo()))

 

sersal10
Creator
Creator
Author

Hi,

 

Error in set modifier expression. Maybe it is impossible? I managed with complex transformations in sql in the database but I woud like to delete that to be more efficient.

marcus_sommer

Your implementation within the above rangesum() of:

weeks_left_to_event<={"current_weeks_left_to_event"} 

isn't correct but your second one of:

days_left_to_event = {"<=$(=current_days_left_to_event)"}

is syntactically ok. If there is an error it's from another part or the content of the fields/variables. 

Beside this you may not get the wanted results with such approach if the comparing needs to happens on a row-level. In this case you will need an if-loop like:

if(weeks_left_to_event <= current_weeks_left_to_event, sum(...))