cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

How to combine two columns in a visual that is a table that is joning two other tables in data model

How do I create a visual that is a table that combines two columns into one column? I have a visual that is using data from two separate tables. Here is the join in the data model:

 

join.png

 

 

 

 

 

 

 

 

 

 

 

 

 

I was able to create a visual that shows the two columns, but I want to combine the two columns into one. It is a date field that exists in either one of the two tables (but not both). I want just one combined column. (In the below picture I want to combine "Loading Date" with "STO Load Date"

combine columns.png

 

 

 

 

 

6 REPLIES 6
Highlighted
Super User IV
Super User IV

Re: How to combine two columns in a visual that is a table that is joning two other tables in data m

@jcueland 

Bring the two dates in one column based on the id into one table.  You can have a measure but that will need context every time

Example

New column in Table 1 = maxx(filter(table2,table1[ID] = table2[ID] && table2[Filter]="Filter",table2[Date])

New column in Table 1 = maxx(filter(table2,table1[ID] = table2[ID] && table1[project] = table2[project]),table2[Date])

 

Then using if or in march release, you have coalesce function create a new date column with both.

 

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User IV
Super User IV

Re: How to combine two columns in a visual that is a table that is joning two other tables in data m

Hi,

In the ZLIP Table, write this calculated column formula

Date = IF(ISBLANK(ZLIP[Loading Date]),ZLIP[STO Load Date],ZLIP[Loading Date])

Drag this Date field to your visual.

Hope this helps.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Highlighted
Super User IV
Super User IV

Re: How to combine two columns in a visual that is a table that is joning two other tables in data m

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




Highlighted
Community Support
Community Support

Re: How to combine two columns in a visual that is a table that is joning two other tables in data m

Hi, @jcueland 

 

Based on your description, I created data to reproduce your scenario.

TableA:

e1.png

TableB:

e2.png

 

There is a one-to-one relationship between tables.

 

You may create a measure like below.

 

Result = 
var _loadingdate = SELECTEDVALUE(TableA[Loading Date])
var _stoloadingdate = SELECTEDVALUE(TableB[STO Load Date])

return 
IF(
    ISBLANK(_loadingdate),
    _stoloadingdate,
    IF(
        ISBLANK(_stoloadingdate),
        _loadingdate,
        _stoloadingdate
    )
)

 

 

Result:

e4.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Highlighted
Helper IV
Helper IV

Re: How to combine two columns in a visual that is a table that is joning two other tables in data m

Thanks! I think that is one step away. My data actually does have some rows after my join that are blank for both values. If both values are blank then it should be blank.

 

So, the logic should be this:

If there is an STO Load Date then use STO Load Date, otherwise

If there is a Loading Date, use Loading DAte, otherwise

Return a blank date

 

Here is how the data comes across in PowerBI currently:

load dates.png

 

I created what the results should look like in excel. The third column (column C) I'm trying to create using the measure.

 

excel.png

 

 

 

Highlighted
Helper IV
Helper IV

Re: How to combine two columns in a visual that is a table that is joning two other tables in data m

Thanks, that seems like it should work, but my STO Load Date doesn't exist in the ZLIP table. Can I add a column to a table that relies on another table? See screen shot below of the DAX formula I tried. When I write the formula I get an error when trying to reference another table.

 

error.png

 

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.

Community Summit North America

Community Summit North America

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

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors