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

MIN VALUE AND COLUMN NAME

I am having below table

ITEMCITY 01CITY 02CITY 03
ITEM 01102013
ITEM 0281212
ITEM 03242014
ITEM 04131520
ITEM 05181414
ITEM 06201624
ITEM 07241813
ITEM 08262012

Need answer as below showing MINIMUM VALUE against EACH line.

ITEMCITY 01CITY 02CITY 03MIN PRICECITY HAVING MIN PRICE
ITEM 0110201310CITY 01
ITEM 02812128CITY 01
ITEM 0324201414CITY 03
ITEM 0413152013CITY 01
ITEM 0518141414CITY 02, CITY 03
ITEM 0620162416CITY 02
ITEM 0724181313CITY 03
ITEM 0826201212CITY 03

Thanks in advance...

Regards,

Manish

9 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Is CITY a dimension with CITY01, CITY02, CITY03 as values?

Can you post your app?

Not applicable
Author

Dear Jason, CITY1, CITY2, CITY3 are dimensions.

Jason_Michaelides
Luminary Alumni
Luminary Alumni

In that case you would be best to crosstable the data.  Can you post some sample data and your app so far?  Easier to help then.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can try with this,

          Have a straight table with the dimensions item, city 01, city 02, city 03

          with expression

               Min Price = RangeMin([CITY 01],[CITY 02],[CITY 03])

               City having Min Price = If([CITY 01] = Column(1), 'CITY 01' & if([CITY 02] = Column(1), ',CITY 02', If([CITY 03] = Column(1), ',CITY 03','')), If([CITY 02] = Column(1), 'CITY 02' & if([CITY 03] = Column(1), ',CITY 03'),

'CITY 03'))

Hope it helps

Celambarasan

Not applicable
Author

Dear Celambarasan,

Appriciate the way you have answered but I have around 30 to 40 CITY dimensions out of which I have given only 3.

Is there any another way.

Regards,

Manish

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Getting the field name of min value from the 40 dimensions is tedious one because as of me there is no method to get the field name based on the value. If you got any other help let me know.

Celambarasan

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Hi Manish,

The attached uses Crosstable() to get however many CITIES there are into a tall thin table.  It is then possible to get the minimum price into a chart, which I have done. The only thing I haven't got working yet is the concatenated string of cities that have the minimum price for each item.  I know you need to use Concat() but I can't get it to limit the values...I'll have another go later.

Anyway - hope this helps.

Jason

Not applicable
Author

Thanks for your reply...

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Hi Manish,

I've managed to complete this for you by adding another bit to the script.  The MinPrice will not be dependent upon other selections by doing it this way but maybe that's OK for you...

Hope it helps,

Jason