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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Update New Column with Data from Other Table

Hello.

I would like to update a custom column with data from a different table.

I have a list of zipcodes with program start dates in one table called DateBeginFootprintZips.

cbrickman_0-1664907928520.png

 

I would like to create a new column in a separate table, iPad_CPM with the BeginDate from DateBeginFootprintZips where the zipcodes match.  For the records in iPad_CPM table that have zips that are not in the first, I would like to update that date to the next day after the max date in DateBeginFootprintZips.  

For example, if the zip in my 2nd table is 30014, I want the new column to have a date of 8/1/2022.  But, if the zip in iPad_CPM is 30012, which is not in the DateBeginFootprintZips table, it should be 8/2/2022, as 8/1/2022 is the Max date.

 

cbrickman_1-1664908662796.png

 

 

 

 

Any help would be very much appreciated.

 

 

 

 

 

1 ACCEPTED SOLUTION

@Anonymous Oh, I missed the +1. I'm not sure how much further I can take this without you posting some sample data and expected output because I'm already starting to get confused.

Column = 
  VAR __zip = [zipcode]
  VAR __Table = FILTER('DateBeginFootprintZips',[Zipcode] = __zip)
RETURN
  IF(COUNTROWS(__Table)+0 = 0, MAX('DateBeginFootprintZips'[DateBegin])+1, MAXX(__Table,[DateBegin]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Anonymous Maybe:

Column = 
  VAR __zip = [zipcode]
  VAR __Table = FILTER('DateBeginFootprintZips',[Zipcode] = __zip)
RETURN
  IF(COUNTROWS(__Table)+0 = 0, MAX('DateBeginFootprintZips'[DateBegin]), MAXX(__Table,[DateBegin]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg,

Thanks for this.  Certainly on the right track.  The start date of 6/6 and 6/13 are only assigned to the corresponding zipcodes.  However, all other zipcodes are assigned to the 8/1 date.  How do I update so that just the corresponding zipcodes are assigned the 8/1, leaving all other zipcodes with no current start date to be assigned 8/2 (Max BeginDate + 1 one day)?

@Anonymous Oh, I missed the +1. I'm not sure how much further I can take this without you posting some sample data and expected output because I'm already starting to get confused.

Column = 
  VAR __zip = [zipcode]
  VAR __Table = FILTER('DateBeginFootprintZips',[Zipcode] = __zip)
RETURN
  IF(COUNTROWS(__Table)+0 = 0, MAX('DateBeginFootprintZips'[DateBegin])+1, MAXX(__Table,[DateBegin]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks Super User Greg!

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors