Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mim
Advocate V
Advocate V

addcolumns from two dimensions tables

i Have two fact tables joined to two dimensions tables, i am trying a dax query to return a calculated table, this dax works for one column, but i don't how to extended to the second column

 

EVALUATE
addcolumns(values(tag[tag]),"earned hours",mstdates[earned hour],"budget hours",mstdates[budget hours])

 

i want to add a new column area[area]

 

thanks for your help

 

edit : i was missing the use of cross join to related different dimensions 

thanks for this blog post

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @mim,

 

Is it possible for you to merge the two fact tables together into one table first in Query Editor? Then you should be able to use ADDCOLUMNS or SUMMARIZE Function (DAX) to get the result you need in this scenario.Smiley Happy

 

Reference: 

POWER BI DESKTOP : MERGE QUERY OPTIONS

Best Practices Using SUMMARIZE and ADDCOLUMNS

 

Regards

View solution in original post

6 REPLIES 6
richbenmintz
Solution Sage
Solution Sage

What if you create a couple of measures, to represent your facts and write something like:

 

evaluate(
summarize
(
'mstdates'
,'tag'[tag]

,'area'[area]
,"earned hours", [earned hour]
,"budget hours", [budget hours]
)
)

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


summarize will work only for 1 table, at least that's my understanding, that's why, i am using addcolumns ?

v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @mim,

 

Is it possible for you to merge the two fact tables together into one table first in Query Editor? Then you should be able to use ADDCOLUMNS or SUMMARIZE Function (DAX) to get the result you need in this scenario.Smiley Happy

 

Reference: 

POWER BI DESKTOP : MERGE QUERY OPTIONS

Best Practices Using SUMMARIZE and ADDCOLUMNS

 

Regards

summarize will work for on base table, but you are able to reference columns in related tables and use measures



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Anonymous
Not applicable

Hi,

Could you post a schema or describe how the relationships look for your tables: tag, mstdates and area?

Since Addcolumns will evaluate all expressions on each row for your "base" table, and the expression must evaluate to a scalar value the relationship from table tag to the table area should be many to one.

 

Does this make sense?

 

Br,

Magnus 

I have two fact tables

fact table 1(tag, area, earned hours)

fact table 2(tag, area, budget hours)

 

the tags and area are not always the same in the two tables 

 

two Master tables

tag(tag) (PK)

area(area)(PK)

 

 

i am looking to have this result 

tag,area, sum(earned hours), sum(budget hours)

 

msdate is just a dummy table for storing measures.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.