Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have three tables
Sales : This table is having Sales information along with few more fields.
Rank : This table is showing Rank for each part on Yearly basis. From and To is profit range
Weightage : This table contains Weightage of Parts for Yearly basis
Objective is
Excel file and QVW both included for your reference.
The above requirement is already achieved using aggr function (check pivot table from QVW file)
but tricky part is user wants Rank and Weighted Average should not be changed on selecting Supplier.
i.e. check Pivot Table.
Here for S4
AverageWeight = 0.3148 and
Rank = 3
(For partial sum of Part column)
If user select S4 from Supplier List Box, the above values (0.3148 and 3) should not change.
In my case, when I am selecting S4, the Weighted Average changes to 0.4048 and Rank to 1.
Please help !
hic
Hi Manish,
the key to the "trick" is that the Rank function should reside within the AGGR() function, and that all the aggregations within the AGGR() are configured to ignore the selection of Supplier. That includes the implied aggregations such as From and To.
Since you are already using AGGR as part of your calculation, you have to add another AGGR for the purpose of correct ranking. I'm attaching your app with the corrected expression.
cheers,
Oleg Troyansky
QlikView Your Business: An expert guide to Business Discovery with QlikView and Qlik Sense
Try:
Round(avg(aggr(Rank(Avg({<Supplier>}Aggr(IF(
(SUM({<Supplier>}Sales)/SUM({<Supplier>}Cost)-1)>=only({<Supplier>}From)
and (SUM({<Supplier>}Sales)/SUM({<Supplier>}Cost)-1)<= only({<Supplier>}To)
,only({<Supplier>}Rank)) * Only ({<Supplier>}Weight)
,Rank,PartYearKey,Supplier)) /SUM({<Supplier>}Total Weight),4),Part,Supplier)))
Hi Oleg,
Getting Closed now... !
The Rank we are getting here is in Decimal.. Can we have Rank like 1,2,3,4,5 ?
The rank is a whole number for each individual product. When you average out multiple ranks into the Suppliers' ranking, you are getting the decimal numbers. I suppose you can round them, but this is simply the logical result of averaging out multiple ranks into one.