Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have [Month] as a filter. I want to be able to select certain months at a random order and run a part of a code for those Months alone.
if(GetSelectedCount([Change])=1 and GetSelectedCount(Month)=1 ,
if(avg(TransitionMonthNum)>=num(Month),
Rangesum(above(total(sum({<Version={'1YP'}>}Value)),0,rowno(total)))
+ sum(total {<TransitionMonth={'$(=getfieldselections(Month))'} , Version={'1YP'}>}Value)*[Change]/100,
Rangesum(above(total(sum({<Version={'1YP'}>}Value)),0,rowno(total)))
)
)
The above code works when only one [Month] is selected. I want this to run when GetSelectedCount(Month)>1 and have the values from GetFieldSelections(Month) in an array or something, and then create a loop, so that the code works for all the months selected.
What would be the best way to do this?
May be like:
TransitionMonth={'$(=chr(39)&GetFieldSelections(Month, chr(39)&','&chr(39))&chr(39))'}
This would generate comma separated; single quoted values in set analysis
you can use this set analysis also like suggested by omarbensalem last time:
TransitionMonth={"$(=concat(Month,'","'))"}
A bit of correction: remove the starting and ending single quotes, like:
TransitionMonth={$(=chr(39)&GetFieldSelections(Month, chr(39)&','&chr(39))&chr(39))}
With concat() you would need additional check if there is a selection or not. Because, even if you don't select from the field, it would return all values.
What is your chart dimension/s here? Would you be able to share an image of what you have and what are you hoping to get?
Hi, tresesco and youssefbelloum
Please let me explain the problem better.
So I have a line chart with Month on the X-axis and cumulative sum(Value) as a measure.
The field [Change] is a number between -50 to +50. If Change=+10 and Month='Aug', The [Value] for Aug increases by 10%. So the [Value] for each month that comes after Aug changes too. (Since it is Cumulative).
Now I want to be able to select multiple Months and change the graph accordingly.
Could you share your sample qvw?
I'm working on Qlik Sense Enterprise, so don't have a QVF.
Share sample raw data and expected output?