Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
_VAT
Contributor
Contributor

Set Expression

Hi,

Need help with set expression for totaling a variable that has to be limited by another variable 

total of             

    ($(vExp.OQ))-($(vExp.DQ))

To be limited by a varaible   which is related to the dimension YearWeek   

            vG.LastWeek

My set expression looks like this but is not working 

(Sum({$<YearWeek={"$(=$(vG.LastWeek))"}>}($(vExp.OQ))-($(vExp.DQ))))

TIA

 

 

 

Labels (2)
1 Reply
njmaehler
Partner - Creator
Partner - Creator

First thing to do is to see exactly what value $(vG.LastWeek) holds by placing a text box onto your page and adding 
=$(vG.LastWeek)
remember the equals sign before it
Based on that result - assuming it returns a single value like 24 then you should be able to use your code without double quotes and double dollar notation because numeric values do NOT require quotes
ie. 
(Sum({$<YearWeek={$(vG.LastWeek)}>}($(vExp.OQ))-($(vExp.DQ))))

e.g. if $(vG.LastWeek) returns a string like "week24" then you need single quotes
(Sum({$<YearWeek={'$(vG.LastWeek)'}>}($(vExp.OQ))-($(vExp.DQ))))


i.e. if you want to select where less than or equal to the max week (assuming it returned a number like 24) then you need the double quotes to change the set analysis into a "search" 
(Sum({$<YearWeek={"<=$(vG.LastWeek)"}>}($(vExp.OQ))-($(vExp.DQ))))

Lastly check other of the other two variable are in fact returning the values you are expecting them too. (same way with a text box)