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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
pbi1908
Helper III
Helper III

Calculated Table with DAX

Hi guys, 

 

I have 2 tables, in one i have Projects and in the other i have tasks.

I would lilke to create a new table with 2 columns, in the first i want to have a union of distinct Names (Project Name and Taks Name), in the second i want an indication from which table the column is come from so the values will be like this (Project, Task). 

 

For the first Column i figured out how to create it (look the code below)

UNION(DISTINCT(Projects[ProjectName]), DISTINCT(Tasks[TaskName])).
 
For the second i don't know how to create it, can anyone help me ? 
 
I prefer a solution in DAX.
 
Thanks.
1 ACCEPTED SOLUTION

Hi,

Thank you for your feedback.

Please check the below DAX formula whether it suits your requirement.

Additionally, if you want to change a column name, you can try to use SELECTCOLUMNS DAX function as well.

 

New table =
SELECTCOLUMNS (
    UNION (
        ADDCOLUMNS ( DISTINCT ( Projects[Project name] ), "Table name", "Project" ),
        ADDCOLUMNS ( DISTINCT ( Tasks[Task name] ), "Table name", "Task" )
    ),
    "@Name", Projects[Project name],
    "@Table", [Table name]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1666179908704.png

 

 

New table =
UNION (
    ADDCOLUMNS ( Projects, "Table name", "Project" ),
    ADDCOLUMNS ( Tasks, "Table name", "Task" )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

@Jihwan_Kim  Hmm yes since i have multiple columns in the table how can i select only the ProjectName from Projects table and only the TaskName from Tasks table instead of all the table?

Hi,

Thank you for your feedback.

Please check the below DAX formula whether it suits your requirement.

Additionally, if you want to change a column name, you can try to use SELECTCOLUMNS DAX function as well.

 

New table =
SELECTCOLUMNS (
    UNION (
        ADDCOLUMNS ( DISTINCT ( Projects[Project name] ), "Table name", "Project" ),
        ADDCOLUMNS ( DISTINCT ( Tasks[Task name] ), "Table name", "Task" )
    ),
    "@Name", Projects[Project name],
    "@Table", [Table name]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.