Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sass
Contributor
Contributor

Set Analysis - for each day with condition

Hello,

I want to count the number of days, but there is a condition in this calcul. 

For one  person, I have a field "goal_per_day" and a mesure "sales".

Example :

Day | Seller | Goal per day | Sales

28/11/2019 |Marc | 300€ | 500€

27/11/2019 |Marc | 300€ | 100€

26/11/2019 |Marc | 300€ | 200€

I want to count the number of days where  the person is below his goal. 

In a table, I want to show all sellers with the number of days below their goals. 

If anyone know how to construct this kpi to use in a table for all sellers, i take it 🙂

 

Thank you !

1 Reply
Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hi Sass,

 

Let's see if you'll take this then 😉

Instead of count, we'll do Sum. Bear with me:

You want a table with the dimension [Seller] and the measure:

Sum(Aggr(If([goal_per_day]>[sales], 1, 0),[Seller], [Day]))

This should work just as fine, if you add the 'Month Dimension' in the table. Or if you are doing selections on Months.

Note: Check field names, you've set two options there, so I used one of them.

Also, I'm not testing it so you can cut me some slack if there are typos 😉

 

Kind regards,

S.T.