Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Yes, just use dollar sign expansion.
LET vFieldSelection = SourceName;
Sum({<
$(vFieldSelection)={'*'},
>} total <[MonthYear]> [Revenue])
In this case $(vFieldSelection) evaluates as SourceName PRIOR TO execution.
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".
Yes, just use dollar sign expansion.
LET vFieldSelection = SourceName;
Sum({<
$(vFieldSelection)={'*'},
>} total <[MonthYear]> [Revenue])
In this case $(vFieldSelection) evaluates as SourceName PRIOR TO execution.
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".
Thanks! Its working like a charm!