Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
Hi,
I've attached a small sample of your request.
Hope that's what your looking for.
Cheers!
iSam
Hi,
I've attached a small sample of your request.
Hope that's what your looking for.
Cheers!
iSam
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