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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need help on a formula

On the table below, under each column, I want to subtract the Expense total from the Revenue total.

The totals under both of these are set under Presentation (Show Partial Sums). 

How do I get a total for the difference between the two types:

Example:  I want to show:   Revenue     242,781.64

                                             Expenses   913,268.59

                                            Net Use     (670,486.95)

SNAG-14102210351700.png

I

Labels (1)
1 Solution

Accepted Solutions
JonnyPoole
Former Employee
Former Employee

If your expression is something like this  sum(numbers)  , then you can change it to something like this

if(  Dimensionality()=0 , 

     sum( {$<Type={Revenue}>}  numbers) - sum( {$<Type={Expenses}>}  numbers) ,

     sum(numbers)

)

This will give you a different formuala for the column footer total (dimensionality=0) and your regular expression for every other cell.

View solution in original post

6 Replies
JonnyPoole
Former Employee
Former Employee

If your expression is something like this  sum(numbers)  , then you can change it to something like this

if(  Dimensionality()=0 , 

     sum( {$<Type={Revenue}>}  numbers) - sum( {$<Type={Expenses}>}  numbers) ,

     sum(numbers)

)

This will give you a different formuala for the column footer total (dimensionality=0) and your regular expression for every other cell.

rubenmarin

Hi Denise you can use:

If(Dimensionality()>0, Sum(Value),

Sum({<Type={'Revenue'}>} Value) - Sum({<Type={'Expenses'}>} Value)

)

Change 'Value' for the field you are using

Not applicable
Author

Where do I put the expression?  Here is how I got the total revenue and total expenses.

I just asked for partial sums  under the presentation tab under Acct#.

SNAG-14102211183500.png

Which gives me the totals for all Revenue and Expenses.

SNAG-14102211152300.png

Then under the Presentation tab I asked for partial Sums under the Type field.

SNAG-14102211231800.png

How do I enter a formula in the (Label for Totals)?

rubenmarin

Hi Denise, it should be your expression in the expressions tab

Not applicable
Author

Hi,

try like this

If(Dimensionality()>0, Sum(Value),

fabs(Sum({<Type={'Revenue'}>} Value) - Sum({<Type={'Expenses'}>} Value))

)

JonnyPoole
Former Employee
Former Employee

On your expression tab you will have an expression that calcualtes the cell values and the totals... it is that expression that you will change with the guidance from before.

The dimensionality()=0 condition will capture cells for TOTALs and calculate them differently.  THere is no separate expression just for totals.

so far you have done everything correctly, just replace the formula of the expression on the expression tab and see what happens next...