cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to write "IF THEN ELSE" statement with BEX query Key Figure technical ID object in SAC

tek_ib
Explorer
0 Kudos
1,042

Hello,

I am trying to create a calculation in SAP analytics cloud on story level which is 

• IF Net Invoice Value is negative then “Credit memo”

My source is BEx query and I have a key figure in the BEx query i.e "Net Invoice Value" which I want to use in the calculated measure.

The technical id of Net Invoice Value in the BEX query is [00O2TKK8G8XRQO3VD5VBZC115]

I tried the following syntax while creating the calculated measure on a story level i.e

IF([00O2TKK8G8XRQO3VD5VBZC115] < 0, "Credit Memo", "")

but I am getting an error message below while writing this logic.

"Formula could not be computed: Object is unknown: 00O2TKK8G8XRQO3VD5VBZC115. Please complete or rewrite the formula".

I will appreciate if you let me know what is wrong with the formula and how to use BEx object in the SAC calculation which has technical ID associated with it.

Thank You very much in advance.

Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

eeddggaarr
Contributor
0 Kudos

Hi tek_ib,

you have to use numeric values only for if - then conditions in SAC and "Credit memo" is a string so this will not work.
with an import connection you could simply create a calculated dimension. For BW live this is not yet available - please vote here. However, your BW team could introduce a new navigation characteristic which is based on your keyfigure. then you could define ranges in BW and which text should be shown for them.

if-then-else in general:
if you write 'if' (without ' ') into calculation editor SAC's auto-completion will create the needed structure:

eeddggaarr_0-1735287765857.png

Now you simply start with the first two numbers of measure ID '00' and SAC will present to you all available measures from your query:

eeddggaarr_1-1735287864434.png

you could also use the description of your measure:

eeddggaarr_2-1735287919641.png

this methods will prevent typos.
BR
Edgar

tek_ib
Explorer
0 Kudos
Hello Edgar, Thanks for the clarification. You are partially correct but I have to use both KF and string in one syntax. For example, {If Net invoice value < 0 Then Invoice status should be "credit memo"] Invoice status is another dimension and it has values such as "credit memo" "Pending payment" etc.