Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Total and Aggr

Hi,

I want to use the Aggr function where one of the variables inn the function needs to calculate the total value for the portfolio at each date and the other variables will aggregate on the dimension defined in the aggr function on each date multiplied by the change in the total portfolio value. I only want one dimension in the chart. 

When i use TOTAL in the variable that calculates the total portfolio value it takes all the dates and calculates one aggregated value for all dates in the Aggr function, disregarding the dimension in chart. I guess this is as expected, but I want the TOTAL function to calculate for each date in the expression below.

Is this possible?

Something like this: 

sum(aggr($(vbPrvSD)* $(vbDSpreadTot)),SecBondSectorName,DateTime))


sum({<Portfolio=P([PortfolioRHS])>}#MaturityWeightPrv*#SpreadDurationPrv*#RiskExpWgtPrv)/sum({<Portfolio=P([PortfolioRHS])>}#RiskExpWgtPrv*#MaturityWeightPrv)


sum({$<Portfolio=P([PortfolioRHS])>}TOTAL #RiskExpWgt*#MaturityWeightPrv*#SpreadDuration*#Spread)/sum({$<Portfolio=P([PortfolioRHS])>}TOTAL #RiskExpWgt*#MaturityWeightPrv*#SpreadDuration)

-

sum({$<Portfolio=P([PortfolioRHS])>}TOTAL #RiskExpWgtPrv*#MaturityWeightPrv*#SpreadDurationPrv*#SpreadPrv)/sum({$<Portfolio=P([PortfolioRHS])>}TOTAL #RiskExpWgtPrv*#MaturityWeightPrv*#SpreadDurationPrv)


Regards,

Haavard

1 Reply
sunny_talwar

Try this

sum({$<Portfolio=P([PortfolioRHS])>}TOTAL <DateTime> #RiskExpWgt*#MaturityWeightPrv*#SpreadDuration*#Spread)/sum({$<Portfolio=P([PortfolioRHS])>}TOTAL #RiskExpWgt*#MaturityWeightPrv*#SpreadDuration)

-

sum({$<Portfolio=P([PortfolioRHS])>}TOTAL <DateTime> #RiskExpWgtPrv*#MaturityWeightPrv*#SpreadDurationPrv*#SpreadPrv)/sum({$<Portfolio=P([PortfolioRHS])>}TOTAL #RiskExpWgtPrv*#MaturityWeightPrv*#SpreadDurationPrv)