Skip to Content
0

Conditional Join in Graphical Calculation View

Sep 13, 2017 at 07:04 PM

254

avatar image

All,

We have been struggling to find a graphical solution for a conditional join using case statements (currently we use script based calculation views, as in my example below). As SAP does not recommend using script based calculation views for performance reasons, and to potentially simplify our current models, I am in search for a graphical solution for this conditional join. Here is the script which pertains to the join:

WHERE.....

and (a."JOIN_OPTION1" = (casewhen a."JOIN_OPTION1" = 'X' then a."JOIN_OPTION1" else b."REFERENCE_NUMBER"end))

and (a."JOIN_OPTION2" = (casewhen a."JOIN_OPTION2" = 'X' then a."JOIN_OPTION2"else b."CUSTOMER"end))

and (a."JOIN_OPTION3" = (casewhen a."JOIN_OPTION3" = 'X' then a."JOIN_OPTION3"else (ifnull(aj."TOTAL_BUDGET", b."SPENDING")) end))

and (a."JOIN_OPTION4" = (casewhen a."JOIN_OPTION4" = 'X' then a."JOIN_OPTION4"else b."COST"end))

Using "JOIN_OPTION1" as an example, there are 2 options which can occur

  • 1) a."JOIN_OPTION1" = a."JOIN_OPTION1" (X) – this is equivalent to no join since x=x.
  • OR
  • 2) a."JOIN_OPTION1" = b."REFERENCE_NUMBER"-- this being an inner join between table A and table B

For our particular business logic both of these scenarios need to be accounted for. I am unable to screen share. I really appreciate any and all feedback if there is a graphical solution! Thanks in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers