Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
i want to increment a value after any variable's change, i've used autonumber(FIELD1,FIELD2) it works but when FIELD1 gets the first value autonumber gives the old value example:
field1 | field1 | number
xx val 1
yy val 2
xx val 1
and this is what i want to do:
xx val 1
yy val 2
xx val 3
Thank you for advance;
Hello @JMAROUF
you can also do :
Data:
load *,if(rowno()=1,1,if(previous(Intermediate&'_'&policy)=Intermediate&'_'&policy,peek(number),(peek(number)+1))) as number
inline [
Intermediate,policy,date
xx,val,01/01/2016
xx,val,01/01/2017
yy,val,01/01/2018
yy,val,01/01/2019
xx,val,01/01/2020
]
output :
One solution for example :
Table1:
load *,if(rowno()=1,1,peek(number)+1) as number
inline [
field1,field2
xx,val
yy,val
xx,val
]
output:
Hi Taoufiq,
Thank you so much for your answer, i've used autonumber() because i have some polices which change intermediate (SLOWLY CHANGING DIMENSION):
field1 | field1 | date
xx val 01/01/2015
xx val 01/01/2016
yy val 01/01/2017
yy val 01/01/2018
yy val 01/01/2019
xx val 01/01/2020
AND WANT THIS:
field1 | field1 | number | date
xx val 1 01/01/2015
xx val 1 01/01/2016
yy val 2 01/01/2017
yy val 2 01/01/2018
yy val 2 01/01/2019
xx val 3 01/01/2020
Hello @Taoufiq_Zarra ,
Thank you for your answer, i've used autonumber for the ( SLOWLY CHANGING DIMENSION), i have some polices which change the intermediate, ex:
Intermediate| policy| date
xx val 01/01/2016
xx val 01/01/2017
yy val 01/01/2018
yy val 01/01/2019
xx val 01/01/2020
and this is what i want:
Intermediate| policy| date | number
xx val 01/01/2016 1
xx val 01/01/2017 1
yy val 01/01/2018 2
yy val 01/01/2019 2
xx val 01/01/2020 3
Hello @JMAROUF
you can also do :
Data:
load *,if(rowno()=1,1,if(previous(Intermediate&'_'&policy)=Intermediate&'_'&policy,peek(number),(peek(number)+1))) as number
inline [
Intermediate,policy,date
xx,val,01/01/2016
xx,val,01/01/2017
yy,val,01/01/2018
yy,val,01/01/2019
xx,val,01/01/2020
]
output :
Thank you @Taoufiq_Zarra , it works well.
Best regards;