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: 
WiscoSippi
Creator
Creator

Variables in Set Analysis, Left side of =

Hello!

I'm trying to use a variable on the LEFT side of my SA equation. The measure is calculating as if there isn't any set analysis.

Any suggestions?

Here's the measure with the variable in red

=sum({< $(vMeasureSelection_542_RA_Account_Group) = {'Revenue'} >} $(vMeasureSelection_RA_542_Actuals) )

That variable contains a pick function and two field names as options:

pick($(vMeasureType), RA_Actuals_Group, Act_Group)

Any thoughts?

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry
1 Solution

Accepted Solutions
WiscoSippi
Creator
Creator
Author

Hello! I figured out how to get it to work. All of the suggestions provided were very helpful but the final solution was slightly different. See below for the working versions. Original pieces are in red and the additional code is in blue:

sum( {< $(=$(vMeasureSelection_542_RA_Account_Group)) = {'Revenue'} >} $(=$(vMeasureSelection_RA_542_Actuals)))

Also had to modify the variable $(vMeasureSelection_542_RA_Account_Group), again additions are in blue:

pick( $(vMeasureType),'[RA_Actuals_Group]','[Act_Group]')

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry

View solution in original post

7 Replies
lblumenfeld
Partner Ambassador
Partner Ambassador

Have you tried this?

Sum(

          If(Pick($(vMeasureType), RA_Actuals_Group, Act_Group) = 'Revenue',

               Pick($(vMeasureType), RA_Actuals_Group, Act_Group),

               0

            )

       )

What can vMeasureType be? If it is a string, instead of a number, then you might need to enclose $(vMeasureType in single quotes.      '$(vMeasureType)'

pradosh_thakur
Master II
Master II

=sum({< [$(vMeasureSelection_542_RA_Account_Group)] = {'Revenue'} >} $(vMeasureSelection_RA_542_Actuals) )


variable


try using an equal sign before

=pick('$(vMeasureType)', RA_Actuals_Group, Act_Group)

or

=pick($(vMeasureType), RA_Actuals_Group, Act_Group)

Learning never stops.
jonathandienst
Partner - Champion III
Partner - Champion III

You can use a variable on the LHS as long as it expands into a valid field name. put =vMeasureSelection_542_RA_Account_Group

into a text box. Does it display the field name?

Is vMeasureType as numeric?

Define vMeasureSelection_542_RA_Account_Group with a leading = sign as suggested above.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
WiscoSippi
Creator
Creator
Author

Hello! I figured out how to get it to work. All of the suggestions provided were very helpful but the final solution was slightly different. See below for the working versions. Original pieces are in red and the additional code is in blue:

sum( {< $(=$(vMeasureSelection_542_RA_Account_Group)) = {'Revenue'} >} $(=$(vMeasureSelection_RA_542_Actuals)))

Also had to modify the variable $(vMeasureSelection_542_RA_Account_Group), again additions are in blue:

pick( $(vMeasureType),'[RA_Actuals_Group]','[Act_Group]')

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry
WiscoSippi
Creator
Creator
Author

Thank you!! I figured it out. Slightly different than what you proposed. I replied to the original post with the correct info.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry
WiscoSippi
Creator
Creator
Author

Thank you!! I figured it out. Slightly different than what you proposed. I replied to the original post with the correct info.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry
WiscoSippi
Creator
Creator
Author

Thank you!! I figured it out. Slightly different than what you proposed. I replied to the original post with the correct info.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry