Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing

I have a field with10 categories. Every category has 10 products, and every product has his own price and the sales revenue.

Now, for eache category, I want to find the first product by revenue, and compare it with the first product (of the same category) which contains the word "Mom". This has to be done for all categories.

How can I do this?

Thanks!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Looks like you can create a field in the script that contains the price of the product with the largest revenue:

Data:

LOAD

     FAMILY,

     PRODUCT,

     PRICE,

     Revenue

FROM ....

JOIN (Data)

LOAD FAMILY, FirstSortedValue(PRICE, -Revenue) as PriceOfMaxRevenueProduct

RESIDENT Data

GROUP BY FAMILY;

You can then use an expression to calculate the ratio: =PriceOfMaxRevenueProduct/PRICE


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Gysbert_Wassenaar

Can you post a qlikview document that demonstrates the problem?


talk is cheap, supply exceeds demand
Not applicable
Author

Now, at the moment, I can't. But I'm going to give you an example here.

Suppose we have 3 categories, like pizza, meat and vegetables. For the category 'Pizza', we have the products 'pizza with ham' that costs €5.00, 'pizza with potatoes' that costs €6.00 exc exc.

In other words, we have this situation:

FAMILY         PRODUCT              PRICE

pizza             pizza with ham           €5.00

pizza             pizza with potatoes   €6.00

pizza             ....................          ............

meat               sausages               €4.00

meat               ..........                    ..........

The most sold pizza is 'pizza with ham'. Now, I want to find the price of the pizza that contains the word 'potatoes' and compare it with the price of 'pizza with ham' (that's, how said before, the pizza with the highest revenue), indipendent of the position of the pizza with potatoes. The comparison has to be done as the price of the pizza with potatoes divided by the price of the first pizza (ham).

The result has to be a table that contains, for each family: the product with the research I want (in this example: 'potatoes'), the first product with highest revenue (pizza with ham) and the price variation between these products.

MayilVahanan

Hi

Provide sample data in excel and your expected result.

it helps to resolve your situation.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
qlikviewwizard
Master II
Master II

patriziostella

Please provide the sample file with the data. So that folks will understanding easily and provide quick solution. Guessing answers will take time to solve your issue. Thank you.

Not applicable
Author

Here is the example file:

Gysbert_Wassenaar

Looks like you can create a field in the script that contains the price of the product with the largest revenue:

Data:

LOAD

     FAMILY,

     PRODUCT,

     PRICE,

     Revenue

FROM ....

JOIN (Data)

LOAD FAMILY, FirstSortedValue(PRICE, -Revenue) as PriceOfMaxRevenueProduct

RESIDENT Data

GROUP BY FAMILY;

You can then use an expression to calculate the ratio: =PriceOfMaxRevenueProduct/PRICE


talk is cheap, supply exceeds demand
MayilVahanan

Hi

Try like this

ProdTemp:

LOAD * INLINE [

    FAMILY, PRODUCT, PRICE, Revenue

    Pizza, pizza with ham, 5, 2000

    Pizza, pizza with sausages, 6, 800

    Pizza, pizza with potatoes, 6, 1500

    Pizza, , 5, 1800

    Meat, chicken, 10, 500

    Meat, sausages and potatoes, 8, 300

];

Left Join

Load FAMILY, FirstSortedValue(PRICE, - Revenue) as MaxRevenuePricePerProd Resident ProdTemp

Group by FAMILY;

Prod:

Load *, if(WildMatch(PRODUCT, '*potatoes*'), PRICE / MaxRevenuePricePerProd) as PriceComparision Resident ProdTemp;

DROP Table ProdTemp;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.