0

I am looking at a fact table which has a certain grain. So each record represents a transaction at that grain. Let's say the grain is header detail sub-detail.

But there are some numeric columns in this table that have values of a higher grain. That is header and detail. So it doesn't make sense to perform sum on these values.

I'm thinking of ways to make this model better so that when user creates a visual from this fact table, then the higher grain columns can still be utilized, and the user will not be allowed to SUM on those column.

One option is to create a measure that does an average of those column.

Another option is to create a measure that returns the first value from the column.

Which of the above approaches is recommended and is there any other approach?

variable
  • 8,262
  • 9
  • 95
  • 215

2 Answers2

2

is there any other approach?

The obvious approach is to move those columns to fact table at a different grain. Power BI also supports automatically switching queries from detail tables to aggregate tables where possible. See User-defined aggregations.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67
0

One alternative approach (which might not fit your situation) is to allocate the number from the header down to the detail level. So if there are 5 detail rows, divide by 5 (or some other weighting). This can then be summed.

This approach would depend on there being some meaning to a detail line taking its fair share of the header number though.

Rich
  • 2,207
  • 1
  • 23
  • 27