Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need help in writing the expression to obtain the desired values

Hi Team,

Using the below data, need to achieve the calculation of "3 days back Country_val"  in a straight table(the current result which i m getting for the calculation and  the expected result are shown in the below second table )                                                                                                                                                                                                                                                                               

CountryDateCountry_val
ABC3/3/201575
ABC3/2/201545
ABC27/2/201534
ABC26/2/201556
ABC25/2/201564
ABC24/2/201545
ABC23/2/201574
ABC20/2/201523
ABC19/2/2015120
ABC18/2/201556
DEF3/3/201554
DEF3/2/201554
DEF27/2/201545
DEF26/2/201589
DEF25/2/201596
DEF24/2/2015101
DEF23/2/2015154
DEF20/2/201548
DEF19/2/2015425
DEF18/2/201545
XYZ3/3/201587
XYZ3/2/201548
XYZ27/2/201544
XYZ26/2/201545
XYZ25/2/2015185
XYZ24/2/2015154
XYZ23/2/2015158
XYZ20/2/201595
XYZ19/2/201545
XYZ18/2/201542

Logic for "3 days back Country_Val" is

for each country, for each date-> we need to get the previous 3rd working day Country_Val value.

Current Problem:

Country=ABC, Date= 26/2/2015, 3 days back Country_Val should return 74(i.e Country Val of 23/2/2015) but it is returning null since the data for 23/2/2015 is not present in the straight table.


Note: no of days back keeps on changing based on the user preference(here it is 3), so the calculation for it should be done in the straight table itself.                                                                                                                                                                                                                                                                  

CountryDateCountry_val3 days back Country_Val(Current   Result)3 days back Country_Val(Expected   Result)
ABC3/3/2015755656
ABC3/2/2015456464
ABC27/2/2015344545
ABC26/2/201556-74
ABC25/2/201564-23
ABC24/2/201545-120
DEF3/3/2015548989
DEF3/2/2015549696
DEF27/2/201545101101
DEF26/2/201589-154
DEF25/2/201596-48
DEF24/2/2015101-425
XYZ3/3/2015874545
XYZ3/2/201548185185
XYZ27/2/201544154154
XYZ26/2/201545-158
XYZ25/2/2015185-95
XYZ24/2/2015154-45

Could anyone help in doing this?

Thanks in  advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Hi all,

Could anyone help in above calculation?

Not applicable
Author

Hi karthi,

Check date format

Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

its working perfectly..:)

Thank you very much