Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
robertsb41
Contributor III
Contributor III

Calculate Measure and Alternate State in Same Expression

Hello,

I'm using a line chart to show data points for multiple alternate states. For each measure I need to include the alternate state in the expression.  I want to sum(sales) only if they were ([Rank]=1) and use the "Company 1" alternate state. 

sum({$<Rank={1},"Company 1">}Sales) - Tried this but no luck.  Also tried If Then statement with no luck.

Thanks in advance!

Labels (2)
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

Replace the $ with the Alternate State name like this:

sum({[Company 1]<Rank={1}>}Sales) 

View solution in original post

6 Replies
GaryGiles
Specialist
Specialist

Replace the $ with the Alternate State name like this:

sum({[Company 1]<Rank={1}>}Sales) 

robertsb41
Contributor III
Contributor III
Author

Perfect!  This community is great.  Now what if I wanted to use the company selection as the label name in the chart?

=' '&GetCurrentSelections(chr(13)&chr(10), '=', ',' ,9,'Company 1')

I tried that but it puts the name of the dimension in front of the company name.

 

GaryGiles
Specialist
Specialist

Not sure I follow how the expression you posted is working.

You may want to try GetFieldSelections(FieldName) or wrap the whole thing with a Replace function to replace 'Company=' with ''.

robertsb41
Contributor III
Contributor III
Author

Think I resolved the label issue by using:

=Only ({'Company 1'} Name_Bidder)

But the label now shows up as - which is better than where I was at before.  Is there a way for making the label not show unless a selection is made from the alternate state?

Thanks for answering my first question, it got me on the right path.  I will update as Solved.

robertsb41
Contributor III
Contributor III
Author

I should clarify, it shows a dash if there isn't a selection.  The company name shows once a selection is made.  I want the label not to show if no selection is made ie get rid of the dash.

GaryGiles
Specialist
Specialist

Try this:

=if(GetSelectedCount(Name_Bidder,True(),'Group 1')>0,Only ({'Company 1'} Name_Bidder),'')