Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Margin Calculation by Country

Hello Friends,

Can someone help me to fix this issue...

I need individual their own values for each country...Please look below image for clear understanding...

www.png

Thanks

venky 

sunindiaalkmov

5 Replies
m_woolf
Master II
Master II

Your calculations are being done in variables, not in the chart expression; therefore they are not being aggregated by the dimension automatically.

You need to change your vMaxNet and vMaxCost variables (and who knows how many others).

vMaxNet would be somthing like:

aggr(Sum({<Year={$(vMaxYear)}>} UnitPrice * Quantity *(1-Discount)),Country)

when the NewGroup selected field is Country.

You can probably replace Country in the expression above with GetCurrentField("New Group")

MK_QSL
MVP
MVP

I can see that the variable declaration is wrong. For Example

vMaxMargin

SUM({<Year = {'$(vMaxYear)'}>}Quantity * UnitPrice * (1-Discount)) - SUM({<Year = {'$(vMaxYear)'}>}Quantity * UnitCost)

vMaxCost

SUM({<Year = {'$(vMaxYear)'}>}Quantity * UnitCost)


vMaxNet

SUM({<Year = {'$(vMaxYear)'}>}Quantity * UnitPrice * (1-Discount))


Similarly use below for previous year.

SUM({<Year = {'$(vPreYear)'}>}Quantity * UnitPrice * (1-Discount)) - SUM({<Year = {'$(vPreYear)'}>}Quantity * UnitCost)



I can't go each and every variables, so better to implement above suggested variables first and try to implement other accordingly..

Not applicable
Author

Why cant i call "New Group" in set analysis...!!

mwoolf

crusader_
Partner - Specialist
Partner - Specialist

Hi venkat,

You got the same result for Margin because those variables declares with "=" (equal sign).

Remove it from variable declaration and check attached result.

Hope this helps you.

Regards,

Andrei Kaliahin