Friday, June 12, 2015

Set Analysis-I

Expression
Meaning
sum({­<Ye­ar=­{“<2015”}>} revenue)
Less than 2015 year
sum({­<Ye­ar=­{“>=2011 <=2015”}>} revenue)
Less than 2015 year, Greater Than 2011 (inclusive)
sum({­<Ye­ar=­{2005, 2007} + {“>=2011 <2015”}>} revenue)
2005, 2006, Less than 2015 year (Excluding 2015), Greater Than 2011 (including 2011)
sum( {$ <$(vDim)={"*"} >} [revenue])
We can use variables with the $ sign. This variable may contain members but also a dimension
sum({$ <$(vSet) >} [Volume Sales])
Using a variable storing the whole set
vSet variable must contain a valid syntax except <> like MANUFACTURER_LDESC ={"*"}, TIME_SDESC={"P 01/13"}
Ye­ar=­{2005, 2007} + {“>=2011 <2015”}
<Year = {"$(=max({1} Year))"}>
Using a function
<Dimension = {" $(=f(args)) "}>
Sum({<KeyAutoNumber = {"=(DayDelivery=DayOrder)" } >} Sales)

Sum({<KeyAutoNumber = {"=(DayDelivery < DayOrder -7)" } >} Sales)
Using two fields
We want to get the sales that have been delivered the same day. We have two fields : DayDelivery and
DayOrder
Sum(if(DayDelivery=DayOrder, Sales))
You can get an equivalent to the above syntax but this is slower because QlikView needs to compute all
the lines of the scope:
sum({<$(vSet)>} Sales)
Let’s create a variable vSet that will be a formula:=if(GetSelectedCount(Product)=1, 'Product=', '$')

3 comments: