Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Stefan_Weber
Contributor III
Contributor III

Calculate Percentage if conditions are fulfilled

Hello Qlikview communitiy, 

I am facing an issue with I could use your help. 

I have the following situation: 

I have multiple Countrys in which I have multiple Stores, in those Stores I have in some cases more than one Department.

Based on some KPIs I have calculated an Overall Performance. Everything between 98% and 102% I have classified as good performance. The formulas with which I calculate if the performance is good or bad already exists. 

CountryStoreDepartmentPerformanceGood performance
GermanyStore 11100 %1
GermanyStore 1297%0
GermanyStore 23100%1
GermanyStore 34102%1

 

Now I want to see the following result: 

CountryStoreDept with good performance [%]
GermanyStore 150 %
GermanyStore 2100 %
GermanyStore 3100 %

 

I want to get rid of the Dimension Department, which leads to issues with my current formulas. 

Right now I am calculating if the performance is good with the following formula. If I now take the Department Dimension from my Piviotchart, the Perfromance is no longer considered by Department but by Store. Which leads to the effect that Store 1 does not have 50% good performance but 100%. 

if($(Performance)> GoodRage_min and $(Performance) <GoodRage_max,1,0)

Any ideas how this could be fixed? I don´t know how to include the Dimension in the if statement. 

Appreciate your help.

Stefan

 

1 Solution

Accepted Solutions
sunny_talwar

How about this

Sum(Aggr(
  If($(Performance) > GoodRage_min and $(Performance) <GoodRage_max, 1, 0)
, Country, Store, Department))
/
Count(DISTINCT Department)

 

View solution in original post

2 Replies
sunny_talwar

How about this

Sum(Aggr(
  If($(Performance) > GoodRage_min and $(Performance) <GoodRage_max, 1, 0)
, Country, Store, Department))
/
Count(DISTINCT Department)

 

View solution in original post

Stefan_Weber
Contributor III
Contributor III
Author

Hello Sunny, 

thanks for your reply, works perfectly. I have been playing around with aggr Funktion for a while but didn´t manage to get it right.

Thank you very much. 

Stefan