Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for
Did you mean:
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.

 Country Store Department Performance Good performance Germany Store 1 1 100 % 1 Germany Store 1 2 97% 0 Germany Store 2 3 100% 1 Germany Store 3 4 102% 1

Now I want to see the following result:

 Country Store Dept with good performance [%] Germany Store 1 50 % Germany Store 2 100 % Germany Store 3 100 %

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.

Stefan

1 Solution

Accepted Solutions
MVP

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

2 Replies
MVP

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

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

Community Browser