Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jeevays7
Partner - Creator III
Partner - Creator III

previous day value till next flag

Hi All,

I have data with date, fund and status wise. I need the output based on status column.

the output field calculation is:

The output column has values of previous OFFICIAL status date value. if there is no previous OFFICIAL status day, then it should be min date value.

The data and output as given below.

how to do this? Please help me

4 Replies
niclaz79
Partner - Creator III
Partner - Creator III

Something like the below expression for Output:

If(Above(Status) = 'OFFICIAL' or isnull(Above(Output)), Value,

          Above(Output)

)

jeevays7
Partner - Creator III
Partner - Creator III
Author

Hi Anderstrom,

Thank you.

but I need the logic in back script. not in chart expression.

Can you suggest any other idea using script functions?

jeevays7
Partner - Creator III
Partner - Creator III
Author

Anderstrom,

And I need OFFICIAL date value also should be previous date OFFICIAL value.

niclaz79
Partner - Creator III
Partner - Creator III

Temp:

noconcatenate

LOAD

     *,

     0 as Output

Resident ....;

drop table ....;

Data:

noconcatenate

LOAD

     Date,

     FundID,

     Status,

     Value,

     If(Previous(Value) = null() or Previous(Status) = 'OFFICIAL', Value,

          Previous(Output)) as Output

Resident Temp

order by Date asc;

where the ..... is the table you currently have the data (without Output in it).

This is based on not seeing your data or your model before, so you may need to make some adjustments.