cancel
Showing results for 
Search instead for 
Did you mean: 

Data Action Error - Calculation with percentages

119ms
Explorer
0 Kudos
369

Hi all,

we are trying to create a data action which should perform the following script logic:

DATA([d/Measures] = "Transactional_Amount") = RESULTLOOKUP([d/Measures] = "Transactional_Amount") * RESULTLOOKUP([d/Measures] = "Variation")

where Variation is an Amount %.

The problem is that when we execute the data action with this calculation, SAC gives the following error:
Extraneous input '%'; expecting EOF.

Is there a way to use an Amount % in SAC data action calculation via scripting without having the above error?

Many thanks,
Martina

Accepted Solutions (0)

Answers (2)

Answers (2)

N1kh1l
Active Contributor
0 Kudos

119ms

The script screenshot was not exactly readable. I tried to simulate a similar example and it worked as expected.

MEMBERSET [d/Measures] = ("Variation","Amount")
MEMBERSET [d/GLACCOUNT]="DS1"

DATA([d/Measures]="Rate") = RESULTLOOKUP([d/Measures]="Amount")*RESULTLOOKUP([d/Measures]="Variation")

To narrow down the issue try to do below.

Validate your script and see if you getting any validation error

The error comes when variation contains % symbol so may be RESULTLOOKUP for variation is returning something with%

So Please go and check in model how this variation value is stored. It should be 0.20 for 20%

As no scope is defined in your script Please ensure that RESULTLOOKUP for variation contains all dimensions within RESULTLOOKUP()

Try assigning only the RESULTLOOKUP for variation to the DATA() and see if it assigns only the variation value at least.

You can also try using a variable and see if it works



MEMBERSET [d/Measures] = ("Variation","Amount")
MEMBERSET [d/GLACCOUNT]="DS1"
FLOAT @variation
@variation=0.0
@variation=RESULTLOOKUP([d/Measures]="Variation")
DATA([d/Measures]="Rate") = RESULTLOOKUP([d/Measures]="Amount")*@variation        


You can set up trace on the script and see what gets assigned to variable variation

Hope it helps !!

Nikhil

N1kh1l
Active Contributor
0 Kudos

119ms

Does your Data Action Advanced Formula validate successfully? May be you can put a screenshot of the code

Please post a snapshot of how have you posted the Variation % in atories

SAC stores data without units. So 5 % variation should be actually 0.05 in database and shown as 5 % in stories


Nikhil

119ms
Explorer
0 Kudos

Hi Nikhil,

the script is in the picture below:

Then, the Variation is the following:

Thanks,

Martina