Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
dmk223
Contributor II
Contributor II

Dynamic set modifier as variable

Hello, 

Is it posible to use variable as modifier field name only?

For example:

Sum({<
vfieldSelection={'*'},
>} total <[MonthYear]> [Revenue])

Where vfieldSelection is going to be 3 diffrent fields, which can be choosed from variable input list to change calculation. 
For example CampaignName, SourceName, CustomChannelGrouping from GA4.

So if I select one of these from variable input, lets say SourceName
i want the set expresssion to be calculated like this:

Sum({<
SourceName={'*'},
>} total <[MonthYear]> [Revenue])


In real scenario set expresions are much more complex, above solution would allow me to make 3 times less visualizations.

 

 

 

 

 

Labels (3)
2 Solutions

Accepted Solutions
daturpin
Partner - Creator II
Partner - Creator II

Yes, just use dollar sign expansion.

LET vFieldSelection = SourceName;

Sum({<
$(vFieldSelection)={'*'},
>} total <[MonthYear]> [Revenue])

In this case $(vFieldSelection) evaluates as SourceName PRIOR TO execution.

View solution in original post

Vegar
MVP
MVP

I would add brackets around the variable expansion l, just in case the field has a whitespace in it. Adding on to @daturpin  suggestion.

Sum({<
[$(vFieldSelection)]={"*"},
>} total <[MonthYear]> [Revenue])

I also adjusted the quotes from 'single' to "double".

View solution in original post

3 Replies
daturpin
Partner - Creator II
Partner - Creator II

Yes, just use dollar sign expansion.

LET vFieldSelection = SourceName;

Sum({<
$(vFieldSelection)={'*'},
>} total <[MonthYear]> [Revenue])

In this case $(vFieldSelection) evaluates as SourceName PRIOR TO execution.

Vegar
MVP
MVP

I would add brackets around the variable expansion l, just in case the field has a whitespace in it. Adding on to @daturpin  suggestion.

Sum({<
[$(vFieldSelection)]={"*"},
>} total <[MonthYear]> [Revenue])

I also adjusted the quotes from 'single' to "double".

dmk223
Contributor II
Contributor II
Author

Thanks! Its working like a charm!