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

Need help with random erratic data

if(Meter_Reading>=(previous(Meter_Reading*2)),'High Cons','Normal Cons') as hlcons 
What i'm trying to achieve is if previous meter reading is 200%

greater than the previous read to show high consumption else normal consumption, but the data coming out just doest match what ive got!

mtr rd.JPG

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

I've attached a small sample of your request.

Hope that's what your looking for.

Cheers!

iSam

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi,

I've attached a small sample of your request.

Hope that's what your looking for.

Cheers!

iSam

swuehl
MVP
MVP

mrpjspencer,

in the table above, the data is ordered by Date.

In your input table that you read in the script (in the load that contains your

line if(Meter_Reading>=(previous(Meter_Reading*2)),'High Cons','Normal Cons') as hlcons   )

, is your data also ordered by Date (maybe using an explicite order by)?

And in above table, are there any more dimensions you group your data by or do you use selection?

The hIcons calculation is only done in the script, using the input data order for the previous function. So, if your data comes in e.g. mixed order of customer / date, your results will not be as expected.

If this is not of any help, could you post your script or best a small sample QV app?

Regards,

Stefan