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
JCallaway82
Frequent Visitor

Lookupvalue Problem

Hello Everyone,

 

I'm having a problem returning a result from a table using multiple criteria.

 

The tables I'm using are Cases and Workfront (which stores current project statuses).

 

2019-02-22-11-09-37-Fleet-Implementation-Triggers-Power-BI-Desktop

I created a concatenated field for each to make a lookup easier...but I get an error.

 

(The green box just shows that a single account can have multiple products...but each individual product/account pair only occurs once/is unique.  Cases are not unique...a single account is likely to have multiple cases for each product)

 

error

 

I really just want the Product_Stage__c value return for each unique cases in the top grid (Cases).

 

 

 

Thanks in advance for any guidance you can provide!

 

~Joseph

1 ACCEPTED SOLUTION

I think I understand what you are trying to do but it seems like your LOOKUPVALUE criteria is not specific enough to return a single value but rather multiple values. I suspect that you must have multiple lines in that other table, perhaps per status with a date assigned. If that is the case, you might try something like this instead:

 

Column = 
VAR __table = FILTER(ALL('Table2'),[Column] = [ID])
VAR __max = MAXX(__table,[Date])
VAR __status = MAXX(FILTER(__table,[Date]=__max),[LookupColumn])
RETURN
__status

So, take the [ID] from your original table and FILTER ALL of the table to a matching column, now you have all rows in the 2nd table for that [ID]. Then, find the MAX date in that table of filtered rows. Finally, filter down to that exact date in the filtered row table and return the status that you are trying to grab ([LookupColumn]).

 

Something along those lines.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

You might try wrapping that in a CONCATENATEX to concatenate multiple values together.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Greg, thanks for responding!

 

I think that is where I am getting confused.  I know my thinking is wrong, but I'm currently thinking that for each row in my cases table I should be able to pull the unique Product stage value for that company/product.

 

 

My up to would be to highlight cases that the product was in a Training stage for example.  

 

Each Product state would show up in the row next to all the other case details and I would do some conditional formatting to highlight those cases.

 

Something like this...

 

ideal2

 

 

Not sure if any of that made sense. But I appreciate the help.

I think I understand what you are trying to do but it seems like your LOOKUPVALUE criteria is not specific enough to return a single value but rather multiple values. I suspect that you must have multiple lines in that other table, perhaps per status with a date assigned. If that is the case, you might try something like this instead:

 

Column = 
VAR __table = FILTER(ALL('Table2'),[Column] = [ID])
VAR __max = MAXX(__table,[Date])
VAR __status = MAXX(FILTER(__table,[Date]=__max),[LookupColumn])
RETURN
__status

So, take the [ID] from your original table and FILTER ALL of the table to a matching column, now you have all rows in the 2nd table for that [ID]. Then, find the MAX date in that table of filtered rows. Finally, filter down to that exact date in the filtered row table and return the status that you are trying to grab ([LookupColumn]).

 

Something along those lines.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks again Greg! You were right. The data table I expected to be unique had duplicates.  The original LookupValue statement worked right after you pointed me in that direction.

 

I appreciate the help.

Awesome @JCallaway82 - glad you got it!!


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.