Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My DB contains fields item, revenue and quantity. Inside the app, it's no problem to calculate price of every item by simply dividing sum(revenue)/sum(quantity), but it will be a measure.
What if I need price as a dimension? can I write same expression in my load script? How do I specify aggregation level? Let's say I have one more field, i.e. Country. and I have country 1, country 2. then, I would need price 1 for country 1-item1 and price 2 for country2 - item 1
To aggregate, you use 'group by' on the fields:
PriceData:
Load
Country,
item,
Sum(revenue)/Sum(quantity) as Price
From SourceData
Group By Country, item;
Thank you Lauri. Your solution works.
I've just realized that in my case simply writing "revenue/quantity as price" without any grouping serves my purpose better.
But thank you very much anyway!