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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Lookupvalue will not return time value

Hi,

 

I've been working on this for six hours, so I thought I would try the community for an answer! I have Googled/lurked the forums to no avail. 

 

I have two tables of data: I'm trying to populate a column in one with data from the other using LOOKUPVALUE.

 

Table One has a list of specific events:

DateTruckJoinKeyEvent TypeTime of EventCarrying
01/01/2016RedRed42370Time Departed12:01:00 PMApples
01/01/2016BlueBlue42370Time Departed1:05:00 PMOranges
01/01/2016YellowYellow42370Time Departed7:33:00 AMBananas
01/01/2016RedRed42370Time Arrived2:53:00 AMBananas
01/01/2016BlueBlue42370Time Arrived4:32:00 PMBananas
01/01/2016YellowYellow42370Time Arrived9:32:00 AMOranges
02/01/2016YellowYellow42371Time Departed5:24:00 AMApples
02/01/2016RedRed42371Time Departed11:24:00 PMApples
02/01/2016BlueBlue42371Time Departed8:11:00 PMOranges
02/01/2016YellowYellow42371Time Arrived12:00:00 AMOranges
02/01/2016RedRed42371Time Arrived4:22:00 AMBananas
02/01/2016BlueBlue42371Time Arrived3:25:00 PMOranges

 

Here is Table 2, the one I'm trying to use LOOKUPVALUE with:

DateTruckJoinKeyTime DepartedTime Arrived
01/01/2016RedRed42370  
01/01/2016BlueBlue42370  
01/01/2016YellowYellow42370  
02/01/2016RedRed42371  
02/01/2016BlueBlue42371  
02/01/2016YellowYellow42371  

 

I am using LOOKUPVALUE with a unique column, "JoinKey" to populate with the values from Table 1. There is only one instance of departed and arrival times for each day and "truck".

Time Departed = LOOKUPVALUE(Table1[Time of Event],Table1[JoinKey],Table2[JoinKey],Table1[Event Type],"Time Departed")

However, I keep getting the error, "A table of multiple values was supplied where a single value was expected."

 

The "JoinKey" column for Table2 has unique values and I have built a many:1 relationship from Table 1 to it.  To test it, I have tried subsituting the "Time of Event" value in the formula with other columns, e.g. "Carrying", and it works fine. The LOOKUPVALUE returns the value from every other column except "Time of Event". 

 

Is LOOKUPVALUE not compatible with time values? I've tried formatting it to text and it still won't work. If I'm not making any sense please let me know... I think I've been staring at this for too long.

 

Any assistance you could provide would be greatly appreciated!

 

Thank you,

 

Kristen

1 ACCEPTED SOLUTION
BhaveshPatel
Community Champion
Community Champion

Hi Kristen,

 

You can use Query editor as well to solve this type of problem.

Just few mouse clicks and you are done. Follow the screenshots for exact solution.

Merge Table 2 and Table 1 as shown in the ScreenshotMerge Table 2 and Table 1 as shown in the ScreenshotExpand the new column and select Event Type & Time of Event CheckboxesExpand the new column and select Event Type & Time of Event CheckboxesChange the data Type of the last column to Time and Rename both the columnsChange the data Type of the last column to Time and Rename both the columnsTime of the Event Column with new Data TypeTime of the Event Column with new Data TypePivot the Column. Select the options shown in the screenshotPivot the Column. Select the options shown in the screenshotAll done. TA....DA........All done. TA....DA........

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

4 REPLIES 4
BhaveshPatel
Community Champion
Community Champion

Hi Kristen,

 

You can use Query editor as well to solve this type of problem.

Just few mouse clicks and you are done. Follow the screenshots for exact solution.

Merge Table 2 and Table 1 as shown in the ScreenshotMerge Table 2 and Table 1 as shown in the ScreenshotExpand the new column and select Event Type & Time of Event CheckboxesExpand the new column and select Event Type & Time of Event CheckboxesChange the data Type of the last column to Time and Rename both the columnsChange the data Type of the last column to Time and Rename both the columnsTime of the Event Column with new Data TypeTime of the Event Column with new Data TypePivot the Column. Select the options shown in the screenshotPivot the Column. Select the options shown in the screenshotAll done. TA....DA........All done. TA....DA........

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
Anonymous
Not applicable

Thank you so much for this!  I had tried merging queries but pivoting was completely new to me. Grateful to have learned something new.

 

Thank you!

Sean
Community Champion
Community Champion

@Anonymous You need to have unique combinations of [JoinKey] and [Event Type]

 

To test this create a COLUMN In Table 1 Create

Column = Table1[JoinKey]&" - "&Table1[Event Type]

Then create this MEASURE

Transactions = COUNTROWS(Table1)

Then create a Visualization Table with the Column and Transactions.

If you see anything other than 1 for each column - that will be what's causing the problem!

Basically the function will have more than 1 possible answer that meets your criteria.

Hope this helps and makes sense! Smiley Happy

 

2016-10-14 - LOOKUPVALUE.png

 

You can use the Visual Level Filters to => show Transactions more than 1 so you can identify the problem faster.

 

EDIT: Just to clarify - my post was merely answering your question about the error message you get with the LOOKUPVALUE.

I would personally also use with the Query Editor to shape your original dataset better.

Anonymous
Not applicable

Thank you very much for the prompt reponse!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.