Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
devarasu07
Master II
Master II

Worst Selling 5 Products?

Hi,

Need to find worst selling 5 product Rank field using below rule,

Tried to create below kind of calculated dimension but it's not working. just shows 0. how to resolve this issue? any suggestions. tks

=aggr(

if(

rank(-(Sum(SoldQty)/Count(DISTINCT ShopNo)),4)<=5

and sum(soh)>=400

and count(distinct ShopNo)>20

and StockType='Seasonal'

and Repeat_Status='0'

and [# Wks Launched]>2

,ArticleNo)

,ArticleNo)

expected output based on above expression

Expected output.png

Expected

Thanks,

Deva

36 Replies
tresesco
MVP
MVP

Your conditions seem to not give any common ArticleNo as an intersection (since you use AND condition). I would rather use the same condition in the expression to respective articles. I have taken ArticleNo as dimension and expression something like:

Sum( {<ArticleNo={"=

rank(-sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}>}SoldQty))<=5"}>//*

//<ArticleNo={"=sum(soh)>=400"}>}

//<ArticleNo={"=count(distinct ShopNo)>20"}>

}

SoldQty)


to get :

Capture.PNG

I just commented out other aggregated conditions because they together give nothing in common as I stated above.


devarasu07
Master II
Master II
Author

Hi tresesco‌,

is it possible to have Rank field (as calculated dimension) because my report has too many measures and also i need to show bottom 5 article picture through text box object.

Many Thanks

Regards,Deva

sunny_talwar

Dimension

=Aggr(If(rank(-sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}>}SoldQty))<=5, Only({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}>}ArticleNo)), ArticleNo)

Expression

Sum(SoldQty)


Capture.PNG

sunny_talwar

Changing the dimension to this brings me closer to the desired output

=Aggr(If(rank(-sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty))<=5,

Only({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}ArticleNo)), ArticleNo)


Capture.PNG

Only difference is the ID ending with 298... Instead of that, I am seeing 324....

devarasu07
Master II
Master II
Author

Hi Sunny,

Your always Perfect   Thanks you very much.

Regards,
Deva

devarasu07
Master II
Master II
Author

Hi stalwar1


Solution working fine with table other chart expect text object. that top 5 images need to show in text box as image as well . i've tried like below way but still it's not working. do you have any suggestion/idea ?


Note: best sellers report able to show as image using text box object. only refer to the below screen shot (table view rank - articleno not matching with text box)

worst5_textobject.JPG

method1:

=only(aggr(if(rank(-sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty),4)=1, 'http://ip address/Article/'&ArticleNo&'.jpg'), ArticleNo))

method2:

=only(aggr(if(

rank(

-sum({<SoldQty={'>0'},Year={$(vCurrYear)},Week={$(vCurrWeek)},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty),4)=1,

'http://IP Address/Article/'&ArticleNo&'.jpg'), ArticleNo))

Thanks,

Deva

sunny_talwar

Try this

=FirstSortedValue(ArticleNo, -Aggr(If(rank(-sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty))<=5,

Sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty)), ArticleNo), 1)

=FirstSortedValue(ArticleNo, -Aggr(If(rank(-sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty))<=5,

Sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty)), ArticleNo), 2)

...

devarasu07
Master II
Master II
Author

Hi stalwar1

Thanks for your reply, instead of the article no, need to show that article respective article picture in text object.

trying to show like below (best sellers - article picture instead of that article no) below one is working but this is best sellers expression i the same way tried but worst sellers expression

=only(aggr(if(rank(sum(TotalNetPriceSGD),4)=1, 'http://IP address of the article picture/Article/'&ArticleNo&'.jpg'), ArticleNo))

=only(aggr(if(

rank(

if(

[# Wks Launched]>$(vMaterialAge) and

sum({<Week={$(=only(Week)+1)},StoreName-={'CK Ware House','CKS-WHS','KM','PWP','Virtual Sloc CN'}>}soh)>=$(=vSoh) and

count(distinct {<StoreName-={'CK Ware House','CKS-WHS','KM','PWP','Virtual Sloc CN'}>} StoreName)>$(vStoreCarry),

-sum({<SoldQty={">0"}>}SoldQty))

,4)=1

, 'http://IP Address of the article picture/Article/'&ArticleNo&'.jpg'), ArticleNo))

below table view has right result but need to show the same worst 5 product picture as text object image. i've tried above expression but it's gave wrong rank and article picture.

Capture.JPG

sunny_talwar

Not sure why your's isn't working because I don't see the images when I open the dashboard... but see if this works or not

=FirstSortedValue('http://192.168.1.3/Article/'&ArticleNo&'.jpg', -Aggr(If(rank(-sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty))<=5,

Sum({<SoldQty={'>0'},StockType={'Seasonal'},Repeat_Status={'0'}, [# Wks Launched]={'>2'}, ArticleNo = {"=sum(soh)>=400 and count(distinct ShopNo)>20"}>}SoldQty)), ArticleNo), 1)

devarasu07
Master II
Master II
Author

Hi Sunny,

This expression works fine. many thanks for your prompt response

Regards,

Deva