Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue need help

Hi All,

I want to calculate the year wise average/sum of salary . I used year as dimension and

below expression in Expression:-

Avg(SALARY)

But..even after doing this i am getting same salary row wiese in every year row ...

Year       Salary

2010       32000

2011       32000

please help me in this regards:---

Sarfaraz

1 Solution

Accepted Solutions
kogasawara
Partner - Creator
Partner - Creator

I cheacked your attached qvw file(setAnalysisTask.qvw).

In your qvw, two tables does not link.

Could you modify load script? like below


---------------------------------------------

Empp:

LOAD ADDRS,

     BIRTH_DATE,

     Year(START_DATE) as year,

     D_NO,

     FIRST_NAME,

     LAST_NAME,

     SALARY,

     SEX,

     SSN,

     START_DATE,

     SUPERSSN

FROM

---------------------------------------------


You need to get the year from Empp table.


Expression:

Avg(Aggr(SUM(SALARY),year))

View solution in original post

13 Replies
MK_QSL
MVP
MVP

Use

Avg(Aggr(SUM(Salary),Year))

Not applicable
Author

Hi manish,

still it is not working ......what is the use of Aggr function ...what it does

Sarfaraz

MK_QSL
MVP
MVP

Provide me some more data or your sample apps

amit_saini
Master III
Master III

Check the attachment.

Thanks,
AS

Not applicable
Author

Please check with the attachment !!!!!!!!

Sarfaraz

MK_QSL
MVP
MVP

Load * Inline

[

  Emplyee, Year, Salary

  A, 2012, 100

  B, 2012, 150

  C, 2012, 200

  A, 2013, 200

  B, 2013, 250

  C, 2013, 300

  A, 2014, 200

  B, 2014, 300

  C, 2014, 400

];

Create a Straight Table

Dimension

Year

Expression

Avg(Salary)

Not applicable
Author

It is working with your example ..straight way you put year number there ......in my case i am taking Year from the field and not working in my case ....request you to please see the above attached file

Hope you will help me

Sarfaraz

MK_QSL
MVP
MVP

Define your

Month and Year in script as below

This should work

Year(Date(Floor(Timestamp#(START_DATE)))) as Year

Month(Date(Floor(Timestamp#(START_DATE)))) as Month

Or

Create a Straight Table

Use below as Calculated Dimension

=Aggr(Year(Date(Floor(Timestamp#(START_DATE)))),START_DATE)

Expression

AVG(SALARY)

its_anandrjs
Champion III
Champion III

Hi,

In expression try this

Avg( TOTAL SALARY ) 

And see what you get also for 2010 and 2011 what is average value from your side.

Regards

Anand