Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I'm unable to create OrderSalesAmount% . It is showing me an error 'Invalid Expression'. Please assist.
[Order Details]:
LOAD Round(LineSalesAmount-COGS,'0.01') AS Margin, * ;
LOAD
OrderID,
OrderLineKey,
ProductID,
Quantity,
UnitPrice,
Discount,
Round(LineSalesAmount,'0.01') AS LineSalesAmount,
ApplyMap('Products_Map',ProductID,'EMPTY')*Quantity AS COGS
FROM [lib://Stages/Stage2/Stage2_Order Details.qvd] (qvd);
OrderMetrics:
Load
OrderID,
SUM(LineSalesAmount) AS OrderSalesAmount,
(LineSalesAmount/SUM(LineSalesAmount)*100) AS OrdersalesAmount%
Resident Fact_table Group By OrderID ;
Your aggregation table does not make sense to create OrderSalesAmount%.
When you aggregate/group by OrderID then you are no longer looking at the LineSalesAmount at the Line level, so this has no place in this table, this can be calculated in the front end.