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

(simple) Measuring sales ?

I am builing a table that needs to show the amount of sales of an accountmanager.

In the customer table there is a relation between customer and accountmanager.

Below is an example of my order table;


OrdeId | Customer | Customer_2 | PRICE |
#1 | (H01) Heineken | empty | 100€ |
#2 | empty | (H01) Heineken | 200€ |


Now I can check the Customer database which accountmanager is matched with Customer and output this in a field. The problem is that sometimes orders are placed when Customer is empty but Customer_2 is used.

I used a Load Customer as KEYCUSTOMER and looked it up in a table, which worked. But I cannot set Load Customer_2 as KEYCUSTOMER also because it gives me back errors.

Any ideas ?

24 Replies
renjithpl
Specialist
Specialist

Hi,

If i understood your question correctly,

is it some thing lile below code..???

Load

Orderid,

If(Customer='', Customer2, Customer) as Customer,

If(Customer2='', Customer, Customer2) as Customer2,

Price

If not, please send me how you want your output to be displayed.

Regards

REn

Not applicable
Author

so, you need to show the total sales by the account manager against particular customer,

so for product table u should take the account manager field and that is as same as the name of the fields in the sales table..

example

sales table Product Table
actMgrName actMgrName

and then associate both table with this actMgrName field
and when user select the account manager name in the select box then

he/she can see the total sales(measure) for customer by account manager

Not applicable
Author

Ranjit, something like that, yes!

I hope my loading script helps a bit by explaining what I need.

LOAD KLT, "KLT_1",

FAC,

JAA,

PER,

OMS,

BEDRAG,

AFR,

REFKLA,

FAKMAKEN;

SQL SELECT KLT,

FAC,

JAA,

PER,

OMS,

BEDRAG,

"KLT_1",

AFR,

REFKLA,

FAKMAKEN

FROM IHFAC03;

Where KLT and "KLT_1" stands for Customer (id's).

I need to have a script that loads the "KLT_1" as KeyCustomer, where when "KLT_1" is empty it loads the value of KLT as KeyCustomer. Because I use another table that matches the value in KeyCustomer to the accountmanager that is responsible for the account.

So I want to merge KLT and "KLT_1" to 1 table, where "KLT_1" is leading, and when this field it empty it fills with the value from KLT.

Do you know what I mean ?

renjithpl
Specialist
Specialist

Hi,

little modified my above code,

LOAD KLT,

If (KLT_1='', KLT, KLT_1) as Customer,

FAC,

JAA,

PER,

OMS,

BEDRAG,

AFR,

REFKLA,

FAKMAKEN;

And in the table you can select Customer and Orderid as dimension and Price as expression.

Please let me know if you have any issues in the above code,

Regards

Ren

Not applicable
Author

Oke, I used your loading script, But it still does not work.

I want to load the value from "KLT_1" as Customer where if "KLT_1" is empty it should use the value from KLT as KeyCustomer.

So using your loading script.. KeyCustomer is still blank, where there should be visible Z06. Thats because KLT has a value of Z06 and "KLT_1" does not have a value. Do you know what I mean ? Hope so : )

Something like:

LOAD KLT as Customer,

If (KLT_1='', KLT, KLT_1) as Customer,

FAC,

JAA,

PER,

OMS,

BEDRAG,

AFR,

REFKLA,

FAKMAKEN;

KeyCustomer KLT "KLT_1" Price

- Z06 - €999











renjithpl
Specialist
Specialist

Hi friend,

i have attached an application, just go through it and get an idea.. If you still have any issues, just copy paste your code, will revert bact with the solution.

Thanks

Ren

renjithpl
Specialist
Specialist

Hi,

I have attached an example, just go through it and get an idea, if you still have any issues, just copy paste your code which you are using in your application.

Regards

Ren

Not applicable
Author

Thanks for your help, but I still havent figuered it out. Let me begin again;

real values in our database:

KLT_1(customer) KLT(billing adress) price

ABC News ABS News Financial Department (Accountmanager value= looks at KLT_1) > Adam

empty ABS News Financial Department (Accountmanager value=looks at empty) > unknown acccuntmanager

I am looking for a load line that when KLT_1 is empty, KeyKLT gives ABS News Financial Department as output. So KeyKLT loads (KLT) because KLT_1 was empty.

So it's the same as joining ROW KLT with KLT_1, but this can only be done if KLT_1 is empty.

I hope I am making any sense 🙂

renjithpl
Specialist
Specialist

just copy and paste here whatever code you typed, let me have a look at it and try to figure out where you made mistake. If you dont mind, you can attach your qvw file.

chill out Smile

thanks..