I am asking for help in optimizing the following metric.
% of Sales revenue =
IF (
SELECTEDVALUE ( PnL[Position Level2] ) = "Online"
&& SELECTEDVALUE ( PnL[Position Level1] ) = "COGS",
DIVIDE (
[P&L AC],
CALCULATE (
[P&L AC],
ALL (
PnL[Sortowanie level 1],
PnL[Position Level1],
PnL[Position Level2],
PnL[Sortowanie level 2]
),
PnL[Position Level1] = "Sales revenue",
PnL[Position Level2] = "Online"
),
0
) * 100,
IF (
SELECTEDVALUE ( PnL[Position Level2] ) = "Offline"
&& SELECTEDVALUE ( PnL[Position Level1] ) = "COGS",
DIVIDE (
[P&L AC],
CALCULATE (
[P&L AC],
ALL (
PnL[Sortowanie level 1],
PnL[Position Level1],
PnL[Position Level2],
PnL[Sortowanie level 2]
),
PnL[Position Level1] = "Sales revenue",
PnL[Position Level2] = "Offline"
),
0
) * 100,
IF (
SELECTEDVALUE ( PnL[Position Level2] ) = "Online"
&& SELECTEDVALUE ( PnL[Position Level1] ) = "Gross margin",
DIVIDE (
[P&L AC],
CALCULATE (
[P&L AC],
ALL (
PnL[Sortowanie level 1],
PnL[Position Level1],
PnL[Position Level2],
PnL[Sortowanie level 2]
),
PnL[Position Level1] = "Sales revenue",
PnL[Position Level2] = "Online"
),
0
) * 100,
IF (
SELECTEDVALUE ( PnL[Position Level2] ) = "Offline"
&& SELECTEDVALUE ( PnL[Position Level1] ) = "Gross margin",
DIVIDE (
[P&L AC],
CALCULATE (
[P&L AC],
ALL (
PnL[Sortowanie level 1],
PnL[Position Level1],
PnL[Position Level2],
PnL[Sortowanie level 2]
),
PnL[Position Level1] = "Sales revenue",
PnL[Position Level2] = "Offline"
),
0
) * 100,
DIVIDE (
[P&L AC],
CALCULATE (
[P&L AC],
ALL (
PnL[Sortowanie level 1],
PnL[Position Level1],
PnL[Position Level2],
PnL[Sortowanie level 2]
),
PnL[Position Level1] = "Sales revenue"
),
0
) * 100
)
)
)
)