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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register 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
Resident Rockstar
Resident Rockstar

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.