Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
as I have a chart expression that I use often, I would like to convert it into a macro so that I can easily call it when needed.
The chart expression is as follows:
=SUM(round(If(rangemax($(m)*a,$(n)*b,c)=0,0,round(rangemax($(m)*a,$(n)*b,c)*Valueloop(1,$(o))-if(Valueloop(1,$(o))=$(o),0.001,0))*(1-d)+((Valueloop(1,$(o))-1/rangemax($(m)*a,$(n)*b,c))/$(o)+1)*d))*e)+SUM(round(If(rangemax($(m)*a,$(n)*b,c)=0,0,round(rangemax($(m)*a,$(n)*b,c)*Valueloop(1,$(o))-if(Valueloop(1,$(o))=$(o),0.001,0))*(1-d)+((Valueloop(1,$(o))-1/rangemax($(m)*a,$(n)*b,c))/$(o)+1)*d))*f*$(q))
Where m,n,o,q are values entered by the user with the input fields.
where a,b,c,d,e,f are imported fields (e.g. size=5).
What is the equivalent of this expression in scripting as a function?
Thanks in advance
You can try storing that into a variable and then evaluating it with SET.
I use something like this in my script.
SET vFuelFlatCount = Sum({<[Invoice Detail Charge Type]={'FUELFL'}>}[Invoice Detail Quantity])
;
And then in my dashboard, I use something like this for my measure:
$(vFuelFlatCount)
Thank you for your reply.
I need it but dynamic in order to call it in chart expression and just to modify my parameters (parameters of the defined function).
This expression should look like in module as:
Function calc(parameters)
for
if ... then
..
end if
next
End function
Any help here?