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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ramasaurio
Frequent Visitor

Fill values that don't exist with values from another column

I have a table with a column with missing values, I want to fill those missing values with a column in another table.

I created this sample data as an example (sample_data.pbix) : 

 

Table A

datevalue_A
Friday, 13 September, 20241623
Sunday, 15 September, 20249584

 

Table B

datevalue_B
Friday, 13 September, 20245483
Saturday, 14 September, 20249084
Sunday, 15 September, 20241234

 

dates

dateweek_id
Friday, 13 September, 202437
Saturday, 14 September, 202437
Sunday, 15 September, 202438

 

The relationship between the tables are as follows using "date" as the key between them.

ramasaurio_0-1726344497413.png

 

what I need to do is create a column with the values of column "value_A" from Table A, and fill the missing values (in this case the value for September 14th) with the values of "value_B". In this case, the column should have the values: 1623, 9084, 9584, for each date respectively.

I'm not really sure how to determine when a row in Table A doesn't exist. Table dates has the complete set of dates but I should leave that table intact. Table B may or may not have all the values, so I should leave a 0 if both Table A and Table B don't have that particular date.

Does anyone have directions for me to achieve this?

Thanks in advance.

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Read about COALESCE

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

Read about COALESCE

Perfection.

Thank you!

ramasaurio_0-1726362690542.png

 

Edit:

The subtotals looks off, it show the same value as value_A. I'll play with it a bit more and see how it works.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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