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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
sangeess21
Creator
Creator

Weighted accuracy calculation

Hi All,

I'm working on Weighted accuracy and I'm stuck at this point.

The rolled up formula for weighted accuracy is correct. The error was on each individual item when you sum it up by product classification. But the problem is the weights are not applied at the lowest level, they are assigned only at the second level in hierarchy. Rollup formula is 1-((error/demand)*weight) and the formula for individual weighted accuracy calculation is (1-(error/demand))*weight.

The hierarchy is (Low to high):

Item

Fcst Product Classification - Weights are assigned at this level

Item Group

Category

Model

Division

Company


The expression works fine if Fcst Product classification is selected under dimensions. But it does not return any result when "Fcst product classification" is not selected. How do I get the weighted accuracy even when Fcst Product Classification is not selected under dimensions?

Image1.JPG

Image2.JPG


Any help would be appreciated.

Thanks,

Sangeetha

1 Solution

Accepted Solutions
sunny_talwar

Not sure, but can you check the attached. It would be helpful if I knew what are the numbers that you expect to see.... but I guess this will help

View solution in original post

4 Replies
sunny_talwar

This is the part which is the issue

If(Dimensionality() = 0,

1 -

Sum({<Flag_Type=>}Aggr((Sum({<Flag_Type=>}Aggr(fabs(Sum(FORECAST_QTY)-Sum({<Flag_Type=>}Demand)),Item)))/Sum({<Flag_Type=>}Demand)*

  Pick(Match(only({<Flag_Type=>}[Fcst Product Classification]), 'High Revenue', 'Commodity', 'High Growth Potential', 'EOS Pending', 'Build to Order', 'Legacy') + 1, 0,

  $(vHighRevenue), $(vCommodity), $(vHighGrowthPotential), $(vEOSPending), $(vBuildToOrder), $(vLegacy)),

[Fcst Product Classification])),

if( not SubStringCount(Concat('"'&_dimension&'"', '|'), '"Fcst Product Classification"'),

(1 -

Sum({<Flag_Type=>}Aggr(((Sum({<Flag_Type=>}Aggr(fabs(Sum(FORECAST_QTY)-Sum({<Flag_Type=>}Demand)),Item)))/Sum({<Flag_Type=>}Demand)),$(=Concat(DISTINCT '[' & _DIM & ']', ', ')&',[Fcst Product Classification]'))))*

  Pick(Match(only({<Flag_Type=>}[Fcst Product Classification]), 'High Revenue', 'Commodity', 'High Growth Potential', 'EOS Pending', 'Build to Order', 'Legacy') + 1, 0,

  $(vHighRevenue), $(vCommodity), $(vHighGrowthPotential), $(vEOSPending), $(vBuildToOrder), $(vLegacy)),

(1 -Sum({<Flag_Type=>}Aggr(((Sum({<Flag_Type=>}Aggr(fabs(Sum(FORECAST_QTY)-Sum({<Flag_Type=>}Demand)),Item)))/Sum({<Flag_Type=>}Demand)),$(=Concat(DISTINCT '[' & _DIM & ']', ', ')))))*

  Pick(Match(only({<Flag_Type=>}[Fcst Product Classification]), 'High Revenue', 'Commodity', 'High Growth Potential', 'EOS Pending', 'Build to Order', 'Legacy') + 1, 0,

  $(vHighRevenue), $(vCommodity), $(vHighGrowthPotential), $(vEOSPending), $(vBuildToOrder), $(vLegacy))))

I guess what are your expected output when you have only Division as a dimension?

sangeess21
Creator
Creator
Author

I want weighted accuracy to return results on all possible dimension selections. The above expression works only when Fcst Product Classification is selected in addition to other dimensions.

sunny_talwar

Not sure, but can you check the attached. It would be helpful if I knew what are the numbers that you expect to see.... but I guess this will help

sangeess21
Creator
Creator
Author

Thanks Sunny   The expression works as expected.