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

Multiple alternate states in single expression

Hi Team,

I need to use below formula with alternate states

Sum(A*B)

where A is coming from State1 and B is coming from State2.

Is it possible to use two alternate state in single sum function?

1 Solution

Accepted Solutions
sunny_talwar

This works

=Sum(Aggr(Sum({$*test1}A)*Sum({$*test2}B), CommonDim))


Capture.PNG

Added the commondim in your sample to show how it will work

LOAD * INLINE [

    FY, A, B, CommonDim

    2016, 13, 15, 1

    2016, 10, 12, 2

    2017, 5, 6, 1

    2017, 7, 8, 2

];

View solution in original post

15 Replies
sunny_talwar

Try to see if this works

Sum(Aggr(Only({State1} A)*Only({State2} B), UniqueIdentifierField))

vipingarg23
Creator
Creator
Author

No..it is not working..

sunny_talwar

Would you be able to share a sample to look at?

vipingarg23
Creator
Creator
Author

Please find the sample file..

I want Sum(A*B)

A is from test1 and B is from test2

vipingarg23
Creator
Creator
Author

There is listbox FY...One Fy has alternate state test1 and another one has test2. For example

FY with test1 is 2017

FY with test2 is 2016

Now column A should take value for FY 2017 (test1) and Column B should take value for FY 2016(test2). Then it should apply the formula:

Sum(A*B)

sunny_talwar

So, based on the selection you have given... what is the expected output here?

vipingarg23
Creator
Creator
Author

Expected Output Should be 196..

vipingarg23
Creator
Creator
Author

If you can tell me any other way to solve this, then also I am fine..

sunny_talwar

How are you calculating this number 196? Can you walk me through the logic?