Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlik community,
Hope this message finds you well.
I am new user of Qlik sense and I need help with calculating a monthly average of the number of sales by sales department employees (in the profil variable, they are named "Salesman") for the year 2024 in Qlik Sense. The challenge is to ensure that only the employees in the sales department (where profil variable is equal to "Salesman") who were active (i.e., who had at least one sale in each month) are included in the average calculation. Here’s a detailed overview of my requirements:
Data Context: My dataset includes sales records spanning multiple years (e.g., from 2022 to 2024). The key fields are:
Employee name
: Unique identifier for each employee.Sale_date
: Date of the sale.Active Salesman Definition: We do not have a leave date. Instead, an employee is considered active in a month if they have at least one recorded sale in that month. If an employee has no sales recorded for a given month, they should be excluded from the average for that month.
Calculation Objective:
Could you provide a step-by-step approach or example Qlik Sense expressions to achieve this?
Here is an example of the database:
Thank you so much in advance for your help on this question! 🙂
Best wishes,
Newbie
Hi @Newbie_QLIK ,
Try something like :
{<Profile={"Salesman"},SalesDate={">=$(=date(monthstart(max(SalesDate))))<=$(=date(max(SalesDate)))"}>}
sum(Sales)/count(distinct EmployeeName)
Basically, here we have defined a set where Profile is restricted to Salesman & SalesDate is restricted to max Month.
Regards,
Rohan.
Hi @Newbie_QLIK,
to respond your request you need to use set analysis in your chart.
For example, if you create a straight table you can add a new columns with this expressions:
Step 1: if(Profile='Salesman', 1, 0) expression to identify the presence of Salesman, then you can filter number rows with number 1
Step 2: SUM({$<Profle={"Salesman"}>}[nb of product])
Step 3: AVG({$<Profle={"Salesman"}}>}[nb of product]) in this case you can insert a variable with month in set expression or select single month from filter panel. In alternative, you can normalize a column with month date and add another column with this expression
Step 4: AVG({$<Profle={"Salesman"}, Sale_date={'$(=Max(Year(Sale_date)))'}>}[nb of product])
hope I was helpful to you.
Thanks
Hi Gomeri,
Thank you for taking your time to answer my question.
Sorry for my confusing long text. In fact, my questionis not using table but the KPI indicator (screenshot below).
I am not sure if your answer can be applied to the KPI indicator as well. If so, could you tell me what it the entire codes to conduct it? I don't think I can directly apply your codes:«
if(Profile='Salesman', 1, 0) //expression to identify the presence of Salesman, then you can filter number rows with number 1
SUM({$<Profle={"Salesman"}>}[nb of product])
AVG({$<Profle={"Salesman"}}>}[nb of product]) //in this case you can insert a variable with month in set expression or select single month from filter panel. In alternative, you can normalize a column with month date and add another column with this expression
AVG({$<Profle={"Salesman"}, Sale_date={'$(=Max(Year(Sale_date)))'}>}[nb of product]) »
I wonder if it is possible to show the average sales per week per salesman (not by salesman name) with KPI indicator? For example, the KPI indicator would be something like 10 sales per week per salesman.
the Calculation Objective was just my procedure to get the average sales per week per salesman in excel. So please feel free to provide any better procedure to get there.
Thank you again for your time.
Best,
Newbie_Qlik
Hi @Newbie_QLIK ,
Try something like :
{<Profile={"Salesman"},SalesDate={">=$(=date(monthstart(max(SalesDate))))<=$(=date(max(SalesDate)))"}>}
sum(Sales)/count(distinct EmployeeName)
Basically, here we have defined a set where Profile is restricted to Salesman & SalesDate is restricted to max Month.
Regards,
Rohan.
Thank you Rohan!
It worked perfectly! Thank you for taking your time to share your knowledge!
I know understant what is set analysis({})
Best,
Newbie_Qlik