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: 
brooksc57
Creator
Creator

Set Analysis Dynamically From Selected Array (via Filter)

I'd have a Field YearQtr with Quarters in it from 2019Q1 and on.

If I select 4 Quarters in a field named YearQtr  as follows     2021Q2, 2021Q3, 2022Q2, 2022Q3
I'd like to Dynamically perform Set Analysis on the Array of these selections.

So  instead of defining the Quarters via Set Analysis like this   Sum({$<YearQtr={'2021Q2'}>}NetSales)

I'd like it to Dynamically program the SetAnalysis like this   

Sum({$<YearQtr={  Array Filter Position 1 }>}NetSales)

Sum({$<YearQtr={  Array Filter Position 2 }>}NetSales)

Sum({$<YearQtr={  Array Filter Position 3 }>}NetSales)

Sum({$<YearQtr={  Array Filter Position 4 }>}NetSales)

I feel like this could be possible but haven't stumbled on either a way or another post where I can find the right keywords to find it. 

Thanks!

Labels (2)
1 Solution

Accepted Solutions
Sabrina_V
Partner - Creator II
Partner - Creator II

Hello,

Will you have one formula for each value of quater ?

I'm thinking of using a variable which will contained the values selected on the field Quater. In order to choose the first one, the second one ... you may use the function subfield.

View solution in original post

5 Replies
Kushal_Chawda

@brooksc57  where would you use these individual set expression? could you elaborate more on your requirement?

Sabrina_V
Partner - Creator II
Partner - Creator II

Hello,

Will you have one formula for each value of quater ?

I'm thinking of using a variable which will contained the values selected on the field Quater. In order to choose the first one, the second one ... you may use the function subfield.

vinieme12
Champion III
Champion III

refer this article

https://community.qlik.com/t5/Member-Articles/Period-Presets-Compare-Periods-on-the-fly/ta-p/1486371

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
brooksc57
Creator
Creator
Author

Hi VP,  that is a cool qvw.  I am building a straight table so that it can sort easy, but that is a really nice 'app' for sure. 

brooksc57
Creator
Creator
Author

That is similar to what I was thinking.  Both taking a night off from looking at it and also reading your thread has me there or very close at least.   

The 1st Period would be something like this in a variable. 

I imagine I could wrap that is some SetAnalysis as well but this will do.

=if(GetSelectedCount(YearMonth,False(),'Period1')>0,
Subfield(Concat({Period1}Distinct YearMonth,';'),';',1),
if(GetSelectedCount(YearQtr,False(),'Period1')>0,
Subfield(Concat({Period1}Distinct YearQtr,';'),';',1),
Subfield(Concat({Period1}Distinct Year,';'),';',1)
))