Compare b/w 2 records and derive value

Record Code Bal Derived Logic
Rec1 8888 8462.21 443.82 Compare Rec1 Bal(8462.21) > Rec2 Bal(443.82) then 443.82 , 0)
Rec2 9431 443.82 443.82
Rec3 2222 300 300 Compare Rec3 Bal(300) < Rec4 Bal(443.82) then 300 , 0)
Rec4 3332 700 700

community team, Please could you share some insights if any one came across similar scenarios or inputs . Apprecite your inputs on same

Hi @sagili80 ,

Welcome back to the community!!

You can use lag() or lead() to compute similar conditional check. The only thing to keep in mind would be using the right partition while fetching lag/lead. Since Record field is alphanumeric sorting may not work the same way as sorting numeric values. You can create a sortkey field to order by for lag /lead implementation.

Thanks,
Prantika

Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community!