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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
croufspesi
Frequent Visitor

Identify specific cell value based on row context and date

I've got a scenario where I can tell I'm close...but not quite there.  Tried combinations of things with FILTER, RELATED, and EARLIER but have not been successful.  Looking to identify the following:

 

For each BrochureCode on the Brochure_Reference table(1), would like Origin to be defined as the CityCode from the earliest start date on EventDetails Table (2) for that related brochure code.  Would like Destination to be the CityCode from the latest start date on the Event Details table (2) for that related BrochureCode.  I also need to exclude the CityCode of "PLW" from all origin and destination determinations.   

 

Table 1: BrochureReference

BrochureCode  |   Start Date   |  Origin  |  Destination  |

66407               |  12/3/18       |      ?       |           ?          |

66408               |  12/6/18       |               |                      |

66409               |  12/11/18     |               |                      |

 

 

Table2: EventDetails

BrochureCode  |  Start Date  |  CityCode  |

66407               |  12/3/18     |    NOL        |

66407               |  12/3/18     |    PLW        |

66407               |  12/4/18     |    MOB       |

66407               |  12/5/18     |    PEN        |

 

Solution for BrochureCode 66407 - Origin = NOL and Destination = PEN

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Here's the M code...

 

Best

D.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Here's the M code...

 

Best

D.

Thanks @Anonymous   I appreciate your help on this

 

I'm relatively new to trying this level of data modeling.  I've taken about 15 hours of online courses through Udemy on DAX/PowerBI, so DAX is just what I'm familiar with because of that course.

 

I can see that in PowerBI M is used... but wasn't sure if as a beginner, I should already be diving into another language and forgetting the one I just recently learned.

Anonymous
Not applicable

Why should you forget DAX while learning M? M is a data mash-up language, whereas DAX is Data Analysis eXpressions language. They serve very different purposes. In addition, you don't have to know M at all to use Power Query. Of course, it's always better to know what's going on under the hood but it's not strictly necessary.

 

Best

Darek

Anonymous
Not applicable

Give me a sec... I'll give you a full working solution in M.

Best
D.
Anonymous
Not applicable

Please use Power Query to do it, not DAX. DAX is not a language to mash up data. M is. DAX is a language to do data analysis, not to shape it.

And besides... in PQ it'll be much, much easier.

Best
D.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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