Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

How to calculate average based on multiple dimensions

Hi,

I would really appreciate for the guidance on the following scenario.

I have 4 columns Emp No, Designation, Salary and Year. And i want to calculate the average salary by designation for each year. But when I display Avg(Salary) measure against Designation and Year dimensions in a table on front end, I am getting same average salary value against all years for a particular designation.

Attached is the sample data with desired and current results i am getting.

Post 1.PNG

Thanks.

Tags (1)
6 Replies
Highlighted
Employee
Employee

Re: How to calculate average based on multiple dimensions

This is not normal behaviour, what details are you not telling us?

Highlighted
Partner
Partner

Re: How to calculate average based on multiple dimensions

I have tried to explain the scenario in detail and provided the completed information. Appreciate if you can point me in the right direction.

Thanks

Tags (1)
Highlighted
Master II
Master II

Re: How to calculate average based on multiple dimensions

1:
LOAD * INLINE [
    Designation, Salary, Year, Emp.Code
    Ayah, 17572, 2020, 10
    Ayah, 19218, 2020, 11
    Ayah, 15135, 2019, 10
    Ayah, 16067, 2019, 11
    Ayah, 14135, 2018, 10
    Ayah, 16067, 2018, 11
    Cleaner, 17572, 2020, 7
    Cleaner, 17572, 2020, 31
    Cleaner, 15440, 2019, 7
    Cleaner, 15440, 2019, 31
    Cleaner, 15750, 2019, 35
    Cleaner, 14440, 2018, 31
    Cleaner, 15750, 2018, 35
    Cleaner, 15440, 2018, 46
];

left join

load Designation,Year, sum(Salary)/count(Designation) as avg Resident 1 Group by Designation,Year;
Highlighted
Partner
Partner

Re: How to calculate average based on multiple dimensions

Thanks Frank.

 

But cannot we achieve the same result from front end  (i.e. app editor) instead of writing script in data loader?

Highlighted
Master II
Master II

Re: How to calculate average based on multiple dimensions

try this as expression:

sum(Salary)/count(Total<Year,Designation>Salary)
Highlighted
Partner
Partner

Re: How to calculate average based on multiple dimensions

Thanks everyone.

I got the desired output.