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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiplication for multiple filters

I am trying to multiply 2 filtered sets from 1 Item but can't figure out how to do this.

My variable STATVALUE contains all the data, and my variable VARIABLEID contains the filters.  In this case I want to multiply the STATVALUE for VARIABLEID = AVERAGEHEATRATE with the STATVALUE for VARIABLEID = GENMARKETFUELPRICE. 

I have tried without sucess

avg( {$<VARIABLEID={'GENMARKETFUELPRICE'}>}STATVALUE * {$<VARIABLEID={'AVERAGEHEATRATE'}>}STATVALUE )

avg( STATVALUE(IF(VARIABLEID='GENMARKETFUELPRICE')) * STATVALUE(IF(VARIABLEID='AVERAGEHEATRATE')) )


These values span over dates so if I split out the average to each piece it works for the monthly level but doesn't compute like I want at the annual level.Below I have

avg( {$<VARIABLEID={'GENMARKETFUELPRICE'}>}STATVALUE)  * avg({$<VARIABLEID={'AVERAGEHEATRATE'}>}STATVALUE )

Capture.PNG

When I compress to the annual level I want to see sum(GENMARKETFUELPRICE(ii)*HR(ii))

Any help with this would be much appreciated.

1 Solution

Accepted Solutions
sunny_talwar

Try like this:

Sum(Aggr(

    Avg({$<VARIABLEID={'GENMARKETFUELPRICE'}>}STATVALUE)  *

    Avg({$<VARIABLEID= {'AVERAGEHEATRATE'}>}STATVALUE)

, Date))

View solution in original post

2 Replies
sunny_talwar

Try like this:

Sum(Aggr(

    Avg({$<VARIABLEID={'GENMARKETFUELPRICE'}>}STATVALUE)  *

    Avg({$<VARIABLEID= {'AVERAGEHEATRATE'}>}STATVALUE)

, Date))

Not applicable
Author

Thank you that worked.