Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with XIRR

Hello

QlikView has a formula to calculate the XIRR.

The formula basically calculates payments cashflow based on periods and returns internal rate.

In a basic example:


xirr( Payments, Dates )

But I need to use an aggregation of payments cashflow, like the example:

xirr( total <Grp> Sum(total <Grp> Payments), Dates)  


Then Help QlikView says:

Valueexpression and dateexpression must not contain aggregation functions, unless these inner aggregations contain the total qualifier. For more advanced nested aggregations, please use the Advanced Aggregation function in combination with calculated dimensions, see Add calculated dimension... .


If the word total occurs before the function arguments the calculation will be made over all possible values given the current selections but disregarding the chart dimension variables.


The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case the calculation will be made disregarding all chart dimension variables except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the cycle or drill-down level changes.

It makes perfect sense, but in practice doesn't works.

Has anyone used this formula using aggregation?

Tks!

1 Solution

Accepted Solutions
Not applicable
Author

I found solution!

For calculate aggregations in XIRR i needed a final aggregation with Sum and Total. I never needed do this aggregation level, but this works.

XIRR(

//Payments

  if([nPer]=0, (Sum(Total Aggr(Sum(Total <Group> [Metric]),Group) ) * -1) ,

     (Sum(Total Aggr(Sum(Total <Group> [Metric]),Group) )  / PmtFactor)

)

  ,

//Dates

  if([nPer]<=72 , [Date])

)


Thanks!

View solution in original post

3 Replies
ramoncova06
Specialist III
Specialist III

I haven't used that formula, but you need to use an aggr for your sum to work properly

QlikView Technical Brief - AGGR.docx

robert_mika
Master III
Master III

Post your expression/app and desired output...

Not applicable
Author

I found solution!

For calculate aggregations in XIRR i needed a final aggregation with Sum and Total. I never needed do this aggregation level, but this works.

XIRR(

//Payments

  if([nPer]=0, (Sum(Total Aggr(Sum(Total <Group> [Metric]),Group) ) * -1) ,

     (Sum(Total Aggr(Sum(Total <Group> [Metric]),Group) )  / PmtFactor)

)

  ,

//Dates

  if([nPer]<=72 , [Date])

)


Thanks!