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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
charleshale
Continued Contributor
Continued Contributor

Bug in Lookupvalue() ?

I am experiencing a result wherein a simple lookupvalue() for the exact same value sometimes returns blank and sometimes doesnt.   I have never seen this before.

 

Here's the detail:  I am adding a simple column via AddColumn that goes to mapping table (Json), looks for the ID number (Json[id]) that matches ('Stripe Raw'[Originating Patch]), and returns the name in the same row of the Json table column [wbs2.1].  

 

 

 

OriginatingPatch_ =   --Adds column into Stripe Raw table of Patch name (the "WBS")
LOOKUPVALUE(Json[WBS2.1], Json[id], 'Stripe Raw'[Originating Patch])

 

 

 

Both Json[Id] and Stripe Raw[Originating Patch] are integers and both columns have blanks within their rows.   Simple, right?
 
Yet here is a snapshot of the sample results, showing for example 'Stripe Raw'[Originating Patch] = 622.  This matches Json[ID] = 622 and the corresponding Json[WBS2.1] is PA_Bethlehem.   As you can see, sometimes PA_Bethlehem gets returned and sometimes blanks get returnded for the same integer.

charleshale_0-1718299936408.png

 

I tried normalizing the formats with INT and FORMAT without any change in outcome.   The following also does not change the outcome: 

 

Try3 = 
CALCULATE(
    FIRSTNONBLANK(Json[WBS2.1], 1),
    FILTER(
        Json,
        Json[Id] = 'Stripe Raw'[Originating Patch]
    )

 

 

 

Note that Debug_OrigPatch =  'Stripe Raw' [Originating Patch]  returns the correct column value (622), but anything like the  Debug_OrigPatch = selectedvalue('Stripe Raw'[Originating Patch]) returns only blanks.

 

Any thoughts? I have never had this issue. Given the amount of time I've spent on it, either I am doing something incredibly dumb that I am missing or it's a bug. Thank you Charlie

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@charleshale So LOOKUPVALUE will return BLANK if more than one row is returned. I've encountered some issues with it honestly which is why I always use MAXX( FILTER( ... ), ... ) instead.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@charleshale So LOOKUPVALUE will return BLANK if more than one row is returned. I've encountered some issues with it honestly which is why I always use MAXX( FILTER( ... ), ... ) instead.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

The greatest @Greg_Deckler.  You have solved my problem with your insight and reflected glory!  So - fantastic point as usual: yes that maxx is better.      Here's what I did, below.

 

 

 

 

 

Try7 = 
CALCULATE(
    maxx(Json, json[WBS2.1]),
    FILTER(
        Json,
        Json[Id] = 'Stripe Raw'[Originating Patch]
    )
)

 

 

 

 However, the problem remained the same.

charleshale_0-1718313919113.png

 

This got me thinking of a totally different solution: adding an all() after calculate.

 

 

 

_OrigPatchNameLkup = 
CALCULATE(
    maxx(json, Json[WBS2.1]),
    FILTER(
        Json,
        Json[Id] = 'Stripe Raw'[Originating Patch]
    ), all('Stripe Raw')
)

 

 

 


This worked.   Somehow there must be a filter context somewhere in my table that was causing the blanks.  I still don't see exactly where, but the column and measure now work.  How interesting!   Thank you for this varsity-level point.

 

Charlie

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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