Forum Discussion
Average Order Lines Count
- 10 years ago
Hi Harris,
I've managed to solve it by bringing Order Number and Order Line to the fact table and then creating a measure like so:
=AVERAGEX(SUMMARIZE('fact';'fact'[OrderNo];"AVG";DISTINCTCOUNT('fact'[OrderLineNo]));[AVG])
Not sure this is the best approach but it works.
Thanks for your help,
Thanks for your answer Harris,
Your suggestion only gives me correct results when looking specifically at the order number level in the pivot. Any other aggregation level within the order dimension is wrong.
And using any other dimension in the pivot is also wrong as well.
Regards,
PowPow Can you elaborate it with some screen shots, what you see now and what is correct?
Secondly the discussion here is in the context of Power BI.
- PowPow10 years agoFrequent Visitor
Hi Harris,
I've managed to solve it by bringing Order Number and Order Line to the fact table and then creating a measure like so:
=AVERAGEX(SUMMARIZE('fact';'fact'[OrderNo];"AVG";DISTINCTCOUNT('fact'[OrderLineNo]));[AVG])
Not sure this is the best approach but it works.
Thanks for your help,
- leonardmurphy10 years agoSkilled Sharer
Storing order number and order line in the fact table is a legitimate star schema design (called a degenerate dimension):
A dimension that has the same number of rows as a fact table is a heads up that a degenerate dimension might be useful.
(Sorry if you already know this)
- PowPow10 years agoFrequent Visitor
Thanks for your input leonardmurphy
I am familiar with the concept of degenerate dimensions but in this particular case i had two concerns. First is that my transaction dimension actually includes several other relevant fields and hierarchies and so i can't just get rid of the dimension.
The other part is related to keeping the pover pivot model as "lean" as possible. Since data is stored by column duplicating such high cardinality columns is expensive.
For the moment i am testing on only a few million rows and haven't really noticed any performance issues but later on the full data set i might need to revisit the approach or try optimizing the model. Plenty of awsome resources about it here if interested.
Regards