Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
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?

15 Replies
vipingarg23
Creator
Creator
Author

Sorry..It should be 159..

Value for Column A For FY 2017 = 5,7

Value for Column B For FY 2016 = 15 12

So (5*15)+(7*12) = 75+84=159

sunny_talwar

How did you choose to multiply 5 with 15 and 7 with 12... why not (5*12) + (7*15)... this is what I am trying to understand here? Is there a common dimension between 5 and 15 and 7 and 12?

vipingarg23
Creator
Creator
Author

Yes..You are right..I didn't take the dimensions in sample...But it will choose according to common dimensions.

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

];

vipingarg23
Creator
Creator
Author

Great Sunny...Thank you so much for your help....

sunny_talwar

No problem at all