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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
rishikeshtiwari
Creator
Creator

Find out optimize price if Possible

I have a table having 5 fields.

I am trying to find optimized Prices.Suppose An item I1 has been sold by 3 Vendors V1,V2,V3 in our table. Unit Prices are also different for all the Vendors. In this case, we need to find out the minimum price for that Particular item I1.

So our requirement is to find out the minimum price and Subtract this minimum price into all the individual prices for that Particular Item for all the Vendors. It is the case for I1 to I3.

But see the I6,I7,I8 we are analyzing that Unit price is same for all the vendors for those respective items.So in this case we need't substract the price. Because all the prices for all the Vendors are same for respective Items.So we need as it is the price.I have attached the result in Excel sheet.

I have find out the subtraction but not able to isolate or restrict the values for those Items which Unit prices are same.

6 Replies
sunny_talwar

FinalTest.qvw seems to be all empty: No Script and nothing available on the front end. Was that the intention?

effinty2112
Master
Master

Hi Rishi,

Is this what you want?

Item Vendor Unit_Price Expr1
I1V1100
I1V22010
I1V33020
I2V1100
I2V22010
I2V33020
I2V44030
I3V1150
I3V22510
I3V33520
I3V44530
I3V55540
I6V12110110
I6V13110110
I7V14100100
I7V15100100
I7 100100
I8V16900900

Expr1:

if(count(Total<Item> DISTINCT Unit_Price) >1,

Unit_Price -  Min(TOTAL <Item>Unit_Price),

Unit_Price)

Regards

Andrew

tamilarasu
Champion
Champion

Hi,

Try this,

Source:
LOAD Item,
Vendor,
Unit_Price,
Quantity
FROM
[MIN_TEST_DATA.xlsx]
(
ooxml, embedded labels, table is [Testing data]);


Left Join

Load Item,
Min(Unit_Price) as Min_Unit_Price,
Max(Unit_Price) as Max_Unit_Price
Resident Source Group by Item;

Final:
Load Item,
Vendor,
Unit_Price,
Quantity,
If(Min_Unit_Price = Max_Unit_Price, Unit_Price, Unit_Price-Min_Unit_Price) as Result
Resident Source;

DROP Table Source;


Untitled.png

rishikeshtiwari
Creator
Creator
Author

Thank you so much Tamil Nagaraj.

rishikeshtiwari
Creator
Creator
Author

Thank you so much Andrew.

tamilarasu
Champion
Champion

Hi Rishi,

Did you get solution.? If yes, please close thread by marking correct/ helpful answers. If not, please let us know.