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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

simple(?) question

hi everyone.

pls look at the file I've attached.

I have only two columns one as budget_type and the other is the vale of it.

I want to add a new record that her budget_type will called "profit" and her value will be:

zzxx-mmkk (170-150) =20 , I want it to be calculate in the script itself.

how can I do that? is it possible to add records based on other recordes in the same dimension ?

thanks a lot

David

1 Solution

Accepted Solutions
Not applicable
Author

Ok, i see. You can do it with:


profit:
LOAD
company,
sum(IF([budget_type]='zzxx', [value])) - sum(IF([budget_type]='mmkk', [value])) AS profit
RESIDENT data
GROUP BY company;


See attached file.

Regards.

View solution in original post

4 Replies
Not applicable
Author

I don´t see the sense of your request.

Why do want to create a new record for profit in script and not in a table or via variable? When you´ve got more than two values, how should you decide what values should be subtract?

Not applicable
Author

hi,

see the new file I've attached.

for each company I have only two values in the budget_type dimension. (the mmkk and the zzxx)

And for each company I want to add a new value called profit.

The users want to select a record name profit (which is a record in the dimension budget_type ) and see the value of it (calculate as zzxx-mmkk )

What are my options if I am not doing it over the script?

thanx,

David

Not applicable
Author

Ok, i see. You can do it with:


profit:
LOAD
company,
sum(IF([budget_type]='zzxx', [value])) - sum(IF([budget_type]='mmkk', [value])) AS profit
RESIDENT data
GROUP BY company;


See attached file.

Regards.

Not applicable
Author

almost...almost...

But you gave me a direction.

I told you its simple.........

I meant to this.

(see attachment)

thanx again