Forum Discussion

MFB's avatar
MFB
Regular Visitor
4 years ago
Solved

Retrieving value in same column with criterias

Hi,

I would like to retrieve value from the same column with different criteria, below an example:

The new price has to be:

  • the actual price of document type [F] if the document date of document [D] is after the document date of [F]
  • the evaluation has to be made for each user (Column 'User')

Thanks a lot in advance for your support

 

Best

  • MFB ,


    new column =
    var _1 = if([Document Type] = "D", maxx(filter(Table, [User] =earlier([User]) && [Document Date] < earlier([Document date]) && [Document Type] = "F"),[Document date]),Blank())
    return
    if([Document Type] = "D" && not(isbalank(_1)) , maxx(filter(Table, [User] =earlier([User]) && [Document Date] =_1 && [Document Type] = "F"),[New Price]),[New Price])

2 Replies

  • MFB ,


    new column =
    var _1 = if([Document Type] = "D", maxx(filter(Table, [User] =earlier([User]) && [Document Date] < earlier([Document date]) && [Document Type] = "F"),[Document date]),Blank())
    return
    if([Document Type] = "D" && not(isbalank(_1)) , maxx(filter(Table, [User] =earlier([User]) && [Document Date] =_1 && [Document Type] = "F"),[New Price]),[New Price])

  • MFB's avatar
    MFB
    Regular Visitor

    thanks amitchandak , really appreciated your support!

     

    With some little change it works!

     

    Best

     

    MFB