Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
AK_
Contributor II
Contributor II

Set analysis - Keep avg of something static in a table

Hi,

I have an issue in my code - in a table with a lot of different ID numbers, both male and female, I have to include a column that will measure the average salary for male individuals only, by level and department. 

My issue is that in rows where the individuals are female, it shows a null value (-) instead of the male average as I need it.

I'm not sure how to show the male average in rows where the employees are female and have tried everything I could find/think of. This is my basic code.

Aggr(Avg(Total<Department, Level> {<Gender = {'Male'}>} Salary),[ID] ,[Level], [Department], Gender)

Please help me figure it out as I have been looking for it for hours now and need to deliver it ASAP.

Thanks in advance you might save me with this one 😅

Labels (3)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

you might not need the aggr()

Try without it: Avg(Total<Department, Level> {<Gender = {'Male'}>} Salary)

View solution in original post

3 Replies
Or
MVP
MVP

As a starting point, I'd suggest adding the set analysis to the Aggr(). I'm not sure if that's the issue - hard to guess with no sample data to test on - but that's a common issue with aggregations involving set analysis.

Vegar
MVP
MVP

you might not need the aggr()

Try without it: Avg(Total<Department, Level> {<Gender = {'Male'}>} Salary)

AK_
Contributor II
Contributor II
Author

That works! Thank you very much.