Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
'Region' has multiple values: Africa, Europe, North East Asia etc.
'SeasonalityTEU_Region' field holds the value. ( grouped at region level in the script load - since each region has multiple 'Origin' )
In the front end, based on the selections made in 'Region, I need for the 'SeasonalityTEU_Region' of each region to be added together.
using the below expression, it works for regions which are a single word, like 'Africa' or 'Europe'. When selection is made with 'North East Asia' for example(or other values which are multiple word string), nothing is returned.
Sum(Aggr({$<Region={$(=GetFieldSelections(Region,','))}>}SeasonalityTEU_Region,Region))
Is the syntax different based on the string value being returned?
thank you
Sum({$<Region={$(=chr(39) & Concat(Distinct Region & chr(39) ,',' & chr(39)))}>}Measure_Name)
Try adding same condition for destination in that expression itself.
Sum({$<Region={$(=chr(39) & Concat(Distinct Region & chr(39) ,',' & chr(39)))} , Destination={$(=chr(39) & Concat(Distinct Destination & chr(39) ,',' & chr(39)))}>}Measure_Name)
Hello G3S,
The reason is you have spaces in your data and you use it in set expression without quoting. You need to quote each element to overcome this issue.
Sum(Aggr({$<Region={$(=chr(34)&GetFieldSelections(Region,chr(34)&',')&chr(34))}>}SeasonalityTEU_Region,Region))
Thank you
Yes, data is string with either single word or multiple words separated by
a space.
*1*. I am not clear on what you mean by quoting each element to overcome
this issue. Could you please explain?
*2*. The expression you shared returns value for single selection. Not for
multiple selections.
I tried adding my initial expression after yours with a +. didn't
work.. (I don't use qlik on an everyday basis. so my set analysis etc is
pretty basic. )
*3*. Could you please adv what adding chr(34) between the field name &
separator in the GetFieldSelections function accomplishes (in bold below)?
------------------------------
Sum(Aggr({$<Region={$(=chr(34)&GetFieldSelections(Region,chr(34)&',')&chr(34))}>}SeasonalityTEU_Region,Region))
------------------------------
appreciate your help please.
Sum({$<Region={$(=chr(39) & Concat(Distinct Region & chr(39) ,',' & chr(39)))}>}Measure_Name)
thank you @UserID2626
from user selection, if I have to consider another dimension 'Destination' in addition to the 'Region' , how would the syntax change?
I have multiple regions and multiple destinations. based on each of the below combination, my output needs to change.
| Region | Destination |
| none selected | 1 selected |
| none selected | multiple selected |
| 1 selected | 1 selected |
| 1 selected | multiple selected |
| multiple selected | 1 selected |
| multiple selected | multiple selected |
Try adding same condition for destination in that expression itself.
Sum({$<Region={$(=chr(39) & Concat(Distinct Region & chr(39) ,',' & chr(39)))} , Destination={$(=chr(39) & Concat(Distinct Destination & chr(39) ,',' & chr(39)))}>}Measure_Name)
thank you @UserID2626 .. that worked 🙂
I now understand the syntax for multiple requirements in set anlysis.. thank you again