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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Mark95
Frequent Visitor

3 condition lookup Power Query

Hi All!

I would like to import a column (Sales Person name) to tansactions details query and to do this, i need to meet 3 conditions.
First one is simple, Customer ID needs to match, the second and third are causing me headache as they reporesent transaction months. Every Sales Person has account assignemnts with start and end months. (representing months when this account was assigned to them)

I need the assginment start month to be lower or equal to transaction month, and end month higher or equal to transaction month(the same column) 
As M code is new to me, i am not sure how to allow ">=","<=" parameters to work in custom formulas. 

This is my first post, i hope this is clear enough but would be happy to answer any questions if need to clarify. 

2 REPLIES 2
AntrikshSharma
Super User
Super User

@Mark95 Post sample data or upload the PBIX to google drive and share the link

@AntrikshSharma 
I have uploaded an example document presented below as well as a snipp of it.
Issue Example Excel file 

Mark95_0-1670425773785.png

 

Below is the formula i tried using in column E of the example file, it works well on small tables but the one my query generets is 100k+ lines, with the lookup table being 40k+ lines.

=IFERROR(INDEX(Lookup_Table[Sales Rep],MATCH(1,(Lookup_Table[Account ID]=[@AccountID])*(Lookup_Table[Assignment start month year]<=[@YearMonth])*(Lookup_Table[Assignment End Month Year]>=[@YearMonth]),0)),"Account not Assigned")

Hope this helps.

Thank you for taking a look into this, hope i will in the future 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.