cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WorkingChepe Frequent Visitor
Frequent Visitor

Lookup by date

I'm trying to move an Excel report to Power Bi, I'm pretty much done but 1 part about a people roster, I'm working with a SharePoint list where I save Quality Evaluations on a daily basis, the employees can change groups depending on different factors and in Excel I had a formula combining VLOOKUP and HLOOKUP based on the date the Quality Evaluation was submitted, something like.

 

Using the HLOOKUP along with the number below the date to help the VLOOKUP find the column to use.

Cannot find how to do this or something similiar in PBI, not sure if I'm being clear but any help will be appreciated

Example.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Lookup by date

Hi @WorkingChepe,

 

We can take the following steps to meet your requirement.

 

1.In power query, we need to remove the Name column and create a new table based on the unique Employye ID using the formula.

 

Table = DISTINCT(ALL(Table1))

 

2.Then create the relationship between the two tables.

 

1.png

 

3.Then I create a calculated column using the formula as below to get the result as we excepted.

 

Gruop2 = IF(DATEDIFF(DATE(2018,07,01),Table2[Evaluation date],DAY)>0 &&DATEDIFF(DATE(2018,07,15),Table2[Evaluation date],DAY)<0,RELATED('Table'[7/1/2018]),IF(DATEDIFF(DATE(2018,07,15),Table2[Evaluation date],DAY)>0 && DATEDIFF(DATE(2018,07,27),Table2[Evaluation date],DAY)<0,RELATED('Table'[7/15/2018]),IF(DATEDIFF(DATE(2018,07,27),Table2[Evaluation date],DAY)>0 &&DATEDIFF(DATE(2018,08,01),Table2[Evaluation date],DAY)<0,RELATED('Table'[7/27/2018]),RELATED('Table'[8/1/2018]))))

 

2.png

 

 

For more details, please check the pbix as attached.

 

https://www.dropbox.com/s/cvbou176d64tblw/Lookup%20by%20date3.pbix?dl=0

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Community Support Team
Community Support Team

Re: Lookup by date

Hi @WorkingChepe,

 

We can take the following steps to meet your requirement.

 

1.In power query, we need to remove the Name column and create a new table based on the unique Employye ID using the formula.

 

Table = DISTINCT(ALL(Table1))

 

2.Then create the relationship between the two tables.

 

1.png

 

3.Then I create a calculated column using the formula as below to get the result as we excepted.

 

Gruop2 = IF(DATEDIFF(DATE(2018,07,01),Table2[Evaluation date],DAY)>0 &&DATEDIFF(DATE(2018,07,15),Table2[Evaluation date],DAY)<0,RELATED('Table'[7/1/2018]),IF(DATEDIFF(DATE(2018,07,15),Table2[Evaluation date],DAY)>0 && DATEDIFF(DATE(2018,07,27),Table2[Evaluation date],DAY)<0,RELATED('Table'[7/15/2018]),IF(DATEDIFF(DATE(2018,07,27),Table2[Evaluation date],DAY)>0 &&DATEDIFF(DATE(2018,08,01),Table2[Evaluation date],DAY)<0,RELATED('Table'[7/27/2018]),RELATED('Table'[8/1/2018]))))

 

2.png

 

 

For more details, please check the pbix as attached.

 

https://www.dropbox.com/s/cvbou176d64tblw/Lookup%20by%20date3.pbix?dl=0

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
WorkingChepe Frequent Visitor
Frequent Visitor

Re: Lookup by date

Thanks ! I'll give it a try !!

Highlighted
Super User
Super User

Re: Lookup by date

Hi,

 

Copy range C1:F1 and paste it in range C2:F2.  In the Query Editor, select the first 2 columns and select "Unpivot other columns"/

 

Hope this helps.

Community Support Team
Community Support Team

Re: Lookup by date

Hi @WorkingChepe,

 

Does that make sense? If so, kindly mark my answer as a solution to close the case.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 6 members 1,681 guests
Please welcome our newest community members: