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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Query Please help

Hi All,

I want to calculate like below

Year               Month               Average Salary         Previous Salary + Average Salary

2010                Jan                   15000                        15000

2010                Feb                   20000                        35000

2010                March               16000                         36000

like this

I reached till average salary ......but what function i should  have to used for Previous + average ....I am calculating this in chart Expression I used Last() function as well .....but did not work..

Help in this regards

Sarfaraz Sheikh

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

21 Replies
ychaitanya
Creator III
Creator III

Use

Load Year,month,Average_Salary,RangeSum(previous(Avergae_Salary),Average Salary) as Tota_Sal

Resident Table_Name

Group By Year,Month,Average_Salary.

Thanks

Chaitanya

Not applicable
Author

New.jpg

Please use the expression sum(AverageSal)

and Enable the below option

Accumulation: Accumulate 2 steps back

its_anandrjs
Champion III
Champion III

Hi,

Or in load script try some thing this ways

A:

LOAD     Year, Month, [Average Salary];

LOAD * INLINE [

    Year, Month, Average Salary

    2010, Jan, 15000

    2010, Feb, 20000

    2010, March, 16000

    2010,Apr,15000

];

NoConcatenate

New:

LOAD Year, Month,[Average Salary],

if(Year = previous(Year),Previous([Average Salary]) + [Average Salary], [Average Salary]) as Total

Resident A;

DROP Table A;

And final op

Avreage.png

Regards

Anand

Not applicable
Author

Hi vasu,


I tried with the Accumulate ....but not working getting  0 in every row ...

Sarfaraz

Not applicable
Author

i thinki u can use in chart level like

total =avg salary+above(sum(avgsalary),1)

Not applicable
Author

Hi Anand,

You Manually Entered the Average salary in your case ........But in my case i am finding it using Average function ...So i tried with average function in my script but it is not working .......

request you to tell me another logic ........

Is it possible to use any relevent fuction in Chart Expression for achieve the same .......

Sarfaraz


anbu1984
Master III
Master III

Check this app

Not applicable
Author

Hi anbu,

Thanks for your help ...but not getting as expected output ...please check the below attached Qvw file..

Sarfaraz

anbu1984
Master III
Master III

Check this app