How to return field name

Hi there how can I get the field name?

I am trying the following pseudo code in “Enter/Edit Expression” for a measure

if (variable in “field_name”, sum(variable), else pass/None )

The idea behind:
I have a custom drop down filter which holds variables. These variables are passed to a line chart as measure via sum(<variable::>). This works fine so far.

But now I want to sum, count, avg based on specific variable names. Any ideas?

@Umut885 You probably need to use a case statement similar to below that looks at what the “variable” contains and chooses the right aggregate to apply. Something like this:

CASE WHEN '<<variable>>'='sales' THEN avg(<<variable>>) 
WHEN '<<variable>>'='transaction' THEN sum(<<variable>>) 
END
1 Like