cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Summarize values by category across 2 fact tables

I have two fact tables  -

Fact1 (CustomerID, ProductID, DateKey, Value1) , Fact2 (CustomerID, ProductID,DateKey,Value2)

 

I'm trying to get a summarized table that gives me 

Summary Table = CustomerID, ProductID, DateKey, Sum(Value1), Sum(Value2)

 

I tried using the Summarize function, but it doesn't work.

If I do SUMMARIZE on Fact1, I get the Sum(Value1)  but Sum(Value2) is blank. If I do SUMMARIZE on Fact2 , the Sum(Value1) is blank.

 

The two FACTS are both related to a Customer, Product & Date Dim table. But there's no direct relationship between them. 

I tried creating a KEY column in both FACT tables and do a USERELATIONSHIP, that didn't work either. 

Appreciate any guidance to resolve this .. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Summarize values by category across 2 fact tables

hi @parimal 

for example

 

Table = 
AddColumns(
SUMMARIZE(Fact1, Fact1[CustomerID], Fact1[ProductID], Fact1[DateKey], "Sum1", SUM(Fact1[Value1])),
"Sum2", CALCULATE(SUM(Fact2[Value2]), FILTER(ALL(Fact2), Fact2[CustomerID]=[CustomerID] && Fact2[ProductID]=[ProductID] && Fact2[DateKey]=[DateKey]))
)

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
Highlighted
Super User II
Super User II

Re: Summarize values by category across 2 fact tables

hi @parimal 

for example

 

Table = 
AddColumns(
SUMMARIZE(Fact1, Fact1[CustomerID], Fact1[ProductID], Fact1[DateKey], "Sum1", SUM(Fact1[Value1])),
"Sum2", CALCULATE(SUM(Fact2[Value2]), FILTER(ALL(Fact2), Fact2[CustomerID]=[CustomerID] && Fact2[ProductID]=[ProductID] && Fact2[DateKey]=[DateKey]))
)

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Highlighted
New Member

Re: Summarize values by category across 2 fact tables

Superb.. Thanks a lot. This worked.. 

I was trying a similar statement for a long time, but I was doing FILTER(Fact2, .... ) , whereas you did a FILTER(ALL(FACT2)... )

putting the ALL made all the difference.. , any idea why it might not have been working without the ALL ??

Highlighted
Super User II
Super User II

Re: Summarize values by category across 2 fact tables

HI @parimal 

without ALL() the statement enables row context (filters depending on your data model). ALL() give a confidence that all table is being calculated


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors