<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Bug in Lookupvalue() ? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bug-in-Lookupvalue/m-p/3991683#M154875</link>
    <description>&lt;P&gt;I am experiencing a result wherein a simple lookupvalue() for the exact same value sometimes returns blank and sometimes doesnt.&amp;nbsp; &amp;nbsp;I have never seen this before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the detail:&amp;nbsp; 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].&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;OriginatingPatch_ =   --Adds column into Stripe Raw table of Patch name (the "WBS")
LOOKUPVALUE(Json[WBS2.1], Json[id], 'Stripe Raw'[Originating Patch])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Both Json[Id] and Stripe Raw[Originating Patch] are integers and both columns have blanks within their rows.&amp;nbsp;&amp;nbsp; Simple, right?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Yet here is a snapshot of the sample results, showing for example 'Stripe Raw'[Originating Patch] = 622.&amp;nbsp; This matches Json[ID] = 622 and the corresponding Json[WBS2.1] is PA_Bethlehem.&amp;nbsp; &amp;nbsp;As you can see, sometimes PA_Bethlehem gets returned and sometimes blanks get returnded&amp;nbsp;&lt;STRONG&gt;for the same integer.&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried normalizing the formats with INT and FORMAT without any change in outcome.&amp;nbsp; &amp;nbsp;The following also does not change the outcome:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Try3 = 
CALCULATE(
    FIRSTNONBLANK(Json[WBS2.1], 1),
    FILTER(
        Json,
        Json[Id] = 'Stripe Raw'[Originating Patch]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that Debug_OrigPatch =&amp;nbsp; 'Stripe Raw' [Originating Patch]&amp;nbsp; returns the correct column value (622), but anything like the&amp;nbsp; Debug_OrigPatch = selectedvalue('Stripe Raw'[Originating Patch]) returns only blanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2024 18:03:59 GMT</pubDate>
    <dc:creator>charleshale</dc:creator>
    <dc:date>2024-06-13T18:03:59Z</dc:date>
    <item>
      <title>Bug in Lookupvalue() ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bug-in-Lookupvalue/m-p/3991683#M154875</link>
      <description>&lt;P&gt;I am experiencing a result wherein a simple lookupvalue() for the exact same value sometimes returns blank and sometimes doesnt.&amp;nbsp; &amp;nbsp;I have never seen this before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the detail:&amp;nbsp; 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].&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;OriginatingPatch_ =   --Adds column into Stripe Raw table of Patch name (the "WBS")
LOOKUPVALUE(Json[WBS2.1], Json[id], 'Stripe Raw'[Originating Patch])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Both Json[Id] and Stripe Raw[Originating Patch] are integers and both columns have blanks within their rows.&amp;nbsp;&amp;nbsp; Simple, right?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Yet here is a snapshot of the sample results, showing for example 'Stripe Raw'[Originating Patch] = 622.&amp;nbsp; This matches Json[ID] = 622 and the corresponding Json[WBS2.1] is PA_Bethlehem.&amp;nbsp; &amp;nbsp;As you can see, sometimes PA_Bethlehem gets returned and sometimes blanks get returnded&amp;nbsp;&lt;STRONG&gt;for the same integer.&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried normalizing the formats with INT and FORMAT without any change in outcome.&amp;nbsp; &amp;nbsp;The following also does not change the outcome:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Try3 = 
CALCULATE(
    FIRSTNONBLANK(Json[WBS2.1], 1),
    FILTER(
        Json,
        Json[Id] = 'Stripe Raw'[Originating Patch]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that Debug_OrigPatch =&amp;nbsp; 'Stripe Raw' [Originating Patch]&amp;nbsp; returns the correct column value (622), but anything like the&amp;nbsp; Debug_OrigPatch = selectedvalue('Stripe Raw'[Originating Patch]) returns only blanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 18:03:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bug-in-Lookupvalue/m-p/3991683#M154875</guid>
      <dc:creator>charleshale</dc:creator>
      <dc:date>2024-06-13T18:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Lookupvalue() ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bug-in-Lookupvalue/m-p/3991748#M154876</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="60227" data-lia-user-login="charleshale" class="lia-mention lia-mention-user"&gt;charleshale&lt;/a&gt;&amp;nbsp;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.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 19:05:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bug-in-Lookupvalue/m-p/3991748#M154876</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-06-13T19:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Lookupvalue() ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bug-in-Lookupvalue/m-p/3991877#M154912</link>
      <description>&lt;P&gt;The greatest &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;.&amp;nbsp; You have solved my problem with your insight and reflected glory!&amp;nbsp; So - fantastic point as usual: yes that maxx is better.&amp;nbsp; &amp;nbsp; &amp;nbsp; Here's what I did, below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Try7 = 
CALCULATE(
    maxx(Json, json[WBS2.1]),
    FILTER(
        Json,
        Json[Id] = 'Stripe Raw'[Originating Patch]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;However, the problem remained the same.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This got me thinking of a totally different solution: adding an all() after calculate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;_OrigPatchNameLkup = 
CALCULATE(
    maxx(json, Json[WBS2.1]),
    FILTER(
        Json,
        Json[Id] = 'Stripe Raw'[Originating Patch]
    ), all('Stripe Raw')
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This worked.&amp;nbsp; &amp;nbsp;Somehow there must be a filter context somewhere in my table that was causing the blanks.&amp;nbsp; I still don't see exactly where, but the column and measure now work.&amp;nbsp; How interesting!&amp;nbsp; &amp;nbsp;Thank you for this varsity-level point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Charlie&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 21:36:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bug-in-Lookupvalue/m-p/3991877#M154912</guid>
      <dc:creator>charleshale</dc:creator>
      <dc:date>2024-06-13T21:36:41Z</dc:date>
    </item>
  </channel>
</rss>

