Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm new with Qlikview and i have some problems, specialy with expressions.
I have Two files like that :
file1
Product | Price |
---|---|
1 | 17 |
2 | 19 |
3 | 21 |
4 | 23 |
file2
Client | Product |
---|---|
Client 1 | 1 |
Client 1 | 2 |
Client 2 | 1 |
Client 1 | 3 |
I want to calculate How much one client spent and display it, so i want to declare a new variable "depense" wich be like that sum(count(products)*price).
I want to know how to do this.
thanks for your answer
You'll need to change the expression to sum(aggr(Price*count(Client),Product,Client))
Hi,
try this expression^^
sum(aggr(count(Product)*Price,Product,Client))
Regards,
Alex
It's not clear to me if Product is a count or a product id. Depending on what's what there are different solutions. See attached qvw.
Thanks for your answers,
it helped me, but there is still confusion.
If for exemple Client 1 bought the same product in an another day :
Client | Product | Date |
---|---|---|
Client 1 | 1 | 1/1/2013 |
Client 1 | 2 | 2/1/2013 |
Client 2 | 1 | 3/1/2013 |
Client 1 | 1 | 4/1/2013 |
If i do the sum, Qlikview will eliminate a double. how to fix that?
I want to notice that Product is an ID.
Best Regards,
You'll need to change the expression to sum(aggr(Price*count(Client),Product,Client))