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
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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors