Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I have the following table:
[SECTOR, P&L
crd financing , -1,931,806
financial, 4,136,933]
and I have to obtain a new field where the sector "crd financing" is partially (80%) included in the financial sector. I wrote in the following way in the load script:
if(settore = 'CRD FINANCING',(0.8*profit),0) as financial_component
since it works correctly then,
if(settore='FINANCIAL', (profit +financial_component),0) as NewProfit
but it doesn't work.
can someone help me?
thanks
Since financial_component is 0 for anything except CRG FINANCING... your script if(settore='FINANCIAL', (profit +financial_component),0) as NewProfit is essentially equal to if(settore='FINANCIAL', (profit +0),0) as NewProfit
Hello Ale Cruc,
Can you post a sample of your code here?
You need to make sure you are using preceding loads. The attribute [financial_component] may not exist yet when you try to use it in a formula.
you can try instead of this:
if(settore='FINANCIAL', (profit +financial_component),0) as NewProfit
doing this:
if(settore='FINANCIAL', (profit +if(settore = 'CRD FINANCING',(0.8*profit),0)),0) as NewProfit
Let me know if this helps!
Kind regards,
S.T.
Are you may be looking to do this?
If(settore = 'CRD FINANCING', (0.8*profit),
If(settore = 'FINANCIAL', profit, 0
)
) as NewProfit
Actually it is more complicated than this as I do not have to fine the real profit of a single sector but of many others.
I try to explain better so my situations is the follwing:
in table1 I have the field SECTOR which is determined by all possible sector i have and the field DESK .
in table2 I have the measure Profit.
The two table are related by a common filed which is the Portfolio and as usual each Portfolio has its own sector, in this way I have linked Table1 and Table2.
Thanks
Where exactly are you trying to do this? In the script or front end?
it does not matter.. i just want to obtain it
better in the script so that i can use the result in different objects in presentation.