Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
warfollowmy_ver
Creator III
Creator III

dynamic name alter state in set analisys

Hi, people!

For example

=sum( { ['Year_1_' & [Shop] ] } )

as

=sum({[Year_1_Shop1]} sales)

Year_1_Shop1 - it's name alter state

where shop it's field, and shop = shop1,

but shop2 will be =sum({[Year_1_Shop2]} sales)

How do it?

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

This kind of thing you can´t do

=sum({[$(='State_spec_'&[Dim1])]}Expression1)

Set analysis are not evaluated per row, it´s evaluated before the aggregation of the object, reducing the record set will be evaluated.

View solution in original post

12 Replies
Clever_Anjos
Employee
Employee

You can use a dolar expansion

=sum({$(=Year_1_Shop' & anothervar)} sales)

warfollowmy_ver
Creator III
Creator III
Author

task to glue the name of an alternate state, the dollar is only one choice. Have you checked? 😃

Clever_Anjos
Employee
Employee

Sorry, didn´t check it, but it works, please check attached

Clever_Anjos
Employee
Employee

The expression: =Sum({[$(='AE'&vEstate)]}Expression1)

swuehl
MVP
MVP

Do you expect your expression to consider the current chart dimension, i.e. Shop?

This won't work, since dollar sign expansion as well as set analysis is only evaluated once per chart, not per dimension line.

If this is the case, you would need to branch your expression based on dimension:

If(Shop = 'Shop1',

     sum({Year_1_Shop1} sales),

     If(Shop= 'Shop2',      sum({Year_1_Shop2} sales) )

)


Not sure if this comes close to what you are trying to do. Please detail your requirements and setting / context.

Anonymous
Not applicable

Hi warfollowmy_verysoon,

You can calculate it on variable, on Set Analysis call variable.


Variable -> ='Year_1_' & MinString([Shop])

Set Analysis -> =sum({$(YourVarName)} Sales)


Or you can do it with Variable with parameter


Variable -> ='Year_1_' &$1

Set Analysis -> =sum({$(YourVarName('Shop2'))} Sales)


Thanks,

sunny_talwar

Nice, good to see that it works

warfollowmy_ver
Creator III
Creator III
Author

Thank you, but the problem is not the point. The task dynamically generate alternative state the name of the column name is not IF function. I have attached an example of your in my first post.

warfollowmy_ver
Creator III
Creator III
Author

Thanks, but no need to IF. On if there is already 😃