Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate using the Total of the straight table

Hi Community,

I want to perform calculations using the Totals of the records in the straight table.

Can we store the totals of the Straight table into variables and use for further calculations?

As shown in the attachment, I have four Total values using them i would like to calculate Adjustment%.

Please let me know in case you have any ideas to achieve the same.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can't access the results of a calculation in a chart from outside the chart (like accessing the values in a table chart cell directly), but you can replicate the expression of that chart column in an variable definition, like

vVar:

=Sum( Amount ) / Count(DISTINCT Month)

To get your variable definition correctly done, it would be helpful if you could post a small sample QVW.

View solution in original post

3 Replies
swuehl
MVP
MVP

If you want to use these values in the total row for Adjustment% in the same chart, try using Column(2), Column(3), Column(4) and Column(5) to access the other expressions values (or reference the expression labels instead).

If you only need to do this in the total line, you can use Dimensionality() function to check if you are evaluating in the total line:

=If(Dimensionality()=0,

    Column(2) + Column(3) + Column(4) +Column(5) // what ever you need to calculate

, YourOtherExpression

)

Not applicable
Author

Hi Stefan,

Thanks alot for your response.

Is there a way i can store these total values in variables and perform the necessary calculations in other chart?

swuehl
MVP
MVP

You can't access the results of a calculation in a chart from outside the chart (like accessing the values in a table chart cell directly), but you can replicate the expression of that chart column in an variable definition, like

vVar:

=Sum( Amount ) / Count(DISTINCT Month)

To get your variable definition correctly done, it would be helpful if you could post a small sample QVW.