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

Using a variable in Set Analysis

I am using Qlik Sense - June 2018 Version.

I am trying to retrieve the values from a set period of time (in this case quarters).  I am able to do this using this formula:

sum( {$<MonthNum = {'>0<4'}>} [QTY Shipped LB] )

which works quite well.  However I want to get creative and have been using variables on a straight table so that they mimic the "alternative measures" found in graphing.  I am able to pick a unit of measure (Lbs, $, Margin) from a variable extension I have simply by clicking on a button.

My problem is I have a variable called "vMeasure", but no matter how I either change the Set Analysis or try and use it in other formulas nothing appears to work.

Any help you can give would be appreciated.  Or a point in the right direction.  I have searched all over but could never find what I need.

14 Replies
Jesh19
Creator II
Creator II

Just try sum(vMeasure)

mhumphreys
Contributor II
Contributor II
Author

I spoke too early.  It is almost there, however the selection of the months Jan-Mar is not working, but I think you put me on the right track.

mhumphreys
Contributor II
Contributor II
Author

Jeshwanth - doesn't work at all.

mhumphreys
Contributor II
Contributor II
Author

Thanks again Jonathan.  I was able to find what I needed thanks to your formula.  Here is the final result.

sum({$<MonthNum={$(='1,2,3')}>} Aggr($(vMeasure), [Core Business Description],Month  ))

This gives me Quarter 1 sales based on whatever button is pressed ($, LBS, or Margin).

Thanks to everybody that helped.

jonathandienst
Partner - Champion III
Partner - Champion III

Glad to help. You can probably simplify the set expression slightly

sum({$<MonthNum={1,2,3}>} Aggr($(vMeasure), [Core Business Description],Month  ))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein