Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

SummarizeColumns() using mulitple fact tables

$
0
0

Hi guys

I require help with the below -

The setup:
I have consumed a model from Lotus notes, i.e. not a proper relational DB, with two fact tables that are related by [File_Number]:

 

Model.png

 

  • The granularity of fctCase is of [Group], i.e. multiple groups can work on a single [File_Number]. It has a population of 80 distinct [File_Number]'s.
  • The granularity of fctTimeManagement is [Hours], [Employee] and [Date] (not shown above) for each [File Number]. It has a sample of 65 distinct [File_Number]'s.
  • dimCase has a population of 80 distinct [File_Number]'s


The challenge:
I require a third table to be materialized made up of the below 5 columns.  However, it must contain all 80 [File_Number]/[Unit] combinations, and the 65 [Group]/[Date] combinations and their associated sum of hours . Essentially, I want to create a LEFT JOIN starting with all 80 [File_Number]'s.

Dimensions:
    dimCase[File_Number]
    ,fctCase[Unit]
    ,fctTimeManagement[Group]
    ,fctTimeManagement[Date]

Measure(s):
    SUM( fctTimeManagement[Hours] )

The problem:
I am having trouble including all 80 [File_Number]'s. Any time I add a dimension from fctTimeManagement it filters the distinct [File_Number]'s to 65.

For example, the below query results in 65 distinct [File_Number]'s. This makes sense because the dimensions are filtered with respect to "Hours_Sum":

Attempt01 = 
SUMMARIZECOLUMNS(
    'dimCase'[File_Number],
    'fctCase'[Unit],
    "Hours_Sum", SUM( fctTimeManagement[Hours] )
)


I need to include all 80 [File_Number]'s though, so I add a measure from a table with all numbers. This results in 80 distinct [File_Number]'s (getting closer...):

Attempt02 = 
SUMMARIZECOLUMNS(
    dimCase[File_Number]
    ,fctCase[Unit]
    ,"rc", COUNTROWS( dimCase ) // <-- added
    ,"Hours_Sum", SUM( fctTimeManagement[Hours] )
)


But as soon as I add a column from the fctTimeManagement table, it filters it back to 65 distinct [File_Number]'s:

Attempt03 = 
SUMMARIZECOLUMNS(
    dimCase[File_Number]
    ,fctCase[Unit]
    ,fctTimeManagement[Date] // <-- Added
    ,"rc", COUNTROWS( dimCase )
    ,"Hours_Sum", SUM( fctTimeManagement[Hours] )
)

 

I've tried other things like playing wtih bi-directional filtering, using IGNORE() or using SUMMARIZE with no luck.

 

Does anyone have a solution?

 

Thanks!


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>