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

In Pivot table, How to fabs first and then sum

Hi,     I’m trying to get the final result as sum of total for the +ve and –ve values. Please help.2016-03-22_10-23-18.pngsunindia

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

If(Dimensionality()<2,

Sum(Aggr(

If(SUM( [TOTAL EXPENSES])>0,SUM( [TOTAL EXPENSES]))

,MARKET,Risk_Type))

,

SUM([TOTAL EXPENSES]))

View solution in original post

12 Replies
sunny_talwar

If you make it positive, I get a little different number using this:

If(Dimensionality() = 2, SUM([TOTAL EXPENSES]), Sum(fabs([TOTAL EXPENSES])))


Capture.PNG

sunny_talwar

The answers matches your if we completely exclude negative from the calculation

If(Dimensionality() = 2, SUM([TOTAL EXPENSES]), Sum({<[TOTAL EXPENSES] = {'>0'}>}[TOTAL EXPENSES]))


Capture.PNG

ramasaisaksoft

Hi Kumar

check the link -ve to +ve convertion

*** Negative Value to Positive Value ***

swuehl
MVP
MVP

If you are trying to show the sum-of-rows (with absolute values) for the partial sums, but still also negative values for the details, I would suggest that you create a field in your data model

LOAD

     ...

     if( left([VENDOR ID],3)= 'CPM' and Risk_Type = 'RISK', 'CAC_RISK', Risk_Type) as New_Risk_Type,

     ...

Then in your chart, use this new field as dimension and as expressions

=If(Dimensionality()<2,

Sum(Aggr(

Fabs(SUM( [TOTAL EXPENSES]))

,MARKET,New_Risk_Type))

,

SUM([TOTAL EXPENSES]))

Anonymous
Not applicable
Author

‌Bro.. Can you check the total for orlando. It should be 73,743,387 when we exclude the negative value completely...

Anonymous
Not applicable
Author

‌Bro.. Can you check the total for orlando. It should be 73,743,387 when we exclude the negative value completely... Please help...

Anonymous
Not applicable
Author

hi swehul,

s‌till I'm getting the wrong total.

swuehl
MVP
MVP

Could you upload the changed QVW with the new dimension and could you also detail what you expect to see, i.e. which lines should show which values and how you derive the values from your original table?

Anonymous
Not applicable
Author

‌As per my requirement, it should exclude the negative value from the total.