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: 
rido1421
Creator III
Creator III

Variance Between Days

Hi There

I have a Date field and an Amount field

[Date],

[Amount]

I would like to create a variance between each day?

And then also in percentage.

What is the easiest way to do this?

  

DateAmountVariance
2015/01/012000
2015/01/02300100
2015/01/03500200
2015/01/04200300
2015/01/05400200
2015/01/06100300
2015/01/07300200
2015/01/08400100

Thanks

1 Solution

Accepted Solutions
v_iyyappan
Specialist
Specialist

5 Replies
v_iyyappan
Specialist
Specialist

Hi,

PFA


Regards,

avinashelite

Hi Rido,

Try like this in the expression:

If(Rowno()=1,0,Previous(amount)-amount)

or

If(Rowno()=1,0,above(amount)-amount)

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

In script

LOAD

*,

If(Rowno()=1,0,amount - Previous(amount)) AS Variance,

If(Rowno()=1,0,(amount - Previous(amount)) /amount AS Variance%,

FROM TableName

ORDER BY Date;

In chart:

If(Rowno()=1,0,amount - above(amount))

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable

Hi Rido,

Try as below

In script:

Amount:
LOAD * Inline
[
Date,Amount
2015/01/01,200
2015/01/02,300
2015/01/03,500
2015/01/04,200
2015/01/05,400
2015/01/06,100
2015/01/07,300
2015/01/08,400
]
;

NoConcatenate

AmountVariance:
LOAD
Date,
Amount,
If(rowno()=1,0,Amount-Previous(Amount)) as AmountVariance,
If(rowno()=1,0,(Amount-Previous(Amount)) /Amount*100) AS AmountVariance%
Resident Amount Order By Date asc;

In chart:

Sort tab: Mark only Load order check box

previous.png

Regards

Neetha

MarcoWedel

Alt(Amount-Previous(Amount),0)