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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
sparur
Specialist II
Specialist II

Problem with SUM

Hello, guys.

I have some problems with such situation:

I have simple table:

error loading image

and I want to get sum of Sales and Plan values by Company, like this:

error loading image

Company, Fields - 2 dimension, Result - expresson.

BUT the main difficulty is that I want to achieve this with one expression!

I created new field with name 'Fields', which contain values with all my Key Figures ('Sales' and 'Plan'),

and I want to use something like this: sum(Fields), but I can't achieve that Fields transform to values,

i.e.
for lines, where Fields = 'Plan' I want get expression - sum(Plan),

for line where Fields = 'Sales' - get sum(Sales)

Can somebody help me?

I know, that can use crosstable function (instead of new field 'Fields') for transforming my source table, but I try to avoid it.

look at my example in attachment.

5 Replies
sparur
Specialist II
Specialist II
Author

anyone have any ideas?

Not applicable

Crosstable is an elegant solution here. I would use that.

sparur
Specialist II
Specialist II
Author

Hello, Matt.

yes, I know that is one of solutions, but I want to avoid it. Because it very "hard" statement. In my real project I have fact table about 5 million of rows and crosstable process take a long time. I want to find more elegant solution(without crosstable), or I want to be sure that crosstable is unique solution.

srinivasa1
Creator II
Creator II

Even I too feel Cross tabel can helpn this case.

sparur
Specialist II
Specialist II
Author

Hello, srinivasa1

I know about crosstable, thanks. but I want to find other solution.