<?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 Re: Get value of partner ticker in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3556509#M136913</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for support. I decided to move column "Peer Code" to Dim_Assets Table and also adjusted the "Peer Current Value" measure as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Peer Current Value = 
VAR LatestPeriod = LASTDATE('Fact_Historical_Data'[Period])
VAR PeerTicker = SELECTEDVALUE(Dim_Assets[Peer Code])
RETURN
IF(
    ISBLANK(PeerTicker),
    BLANK(),
    CALCULATE(
        SUM(Fact_Historical_Data[Value]),
        All(Fact_Historical_Data),
        Fact_Historical_Data[Ticker Code] = PeerTicker,
        Fact_Historical_Data[Period] = LatestPeriod
    )
)&lt;/LI-CODE&gt;&lt;P&gt;So I added filter "All(Fact_Historical_Data)" and now it works.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
    <pubDate>Tue, 28 Nov 2023 13:15:41 GMT</pubDate>
    <dc:creator>oanu</dc:creator>
    <dc:date>2023-11-28T13:15:41Z</dc:date>
    <item>
      <title>Get value of partner ticker</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3553915#M136751</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I would like to get the latest value of “Counterpart” ticker (aka “Peer”) of the selected ticker. Below are the details:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Model has 4 tables: Dim_Assets contains some metadata for tickers; Peers table specify which Ticker has which Peer (Peer is also Ticker Code from Dim_Assets); Historical Data is obvious.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All Ticker Codes have historical data. Several Ticker code could have the same Peer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some measures which work just fine:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current Value = CALCULATE(SUM('Fact_Historical_Data'[Value]),LASTDATE('Fact_Historical_Data'[Period]))

Date of Current Value = CALCULATE(SUM('Fact_Historical_Data'[Period]),LASTDATE('Fact_Historical_Data'[Period]))

Peer Existence Check = 
VAR CurrentTicker = SELECTEDVALUE(Dim_Assets[Ticker Code])
RETURN LOOKUPVALUE(Peers[Peer Code], Peers[Ticker Code], CurrentTicker, Blank())

Peer Latest Period = 
VAR CurrentTicker = SELECTEDVALUE(Dim_Assets[Ticker Code])
VAR PeerTicker = LOOKUPVALUE(Peers[Peer Code], Peers[Ticker Code], CurrentTicker, BLANK())
RETURN
IF(NOT ISBLANK(PeerTicker),
CALCULATE(MAX(Fact_Historical_Data[Period]), Fact_Historical_Data[Ticker Code] = PeerTicker, ALL(Fact_Historical_Data)),
BLANK()
)&lt;/LI-CODE&gt;&lt;P&gt;However, the measure to get the value of Peer always returns blank:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Peer Current Value = 
VAR LatestPeriod = CALCULATE(MAX(Fact_Historical_Data[Period]), ALL(Fact_Historical_Data))
VAR CurrentTicker = SELECTEDVALUE(Dim_Assets[Ticker Code])
VAR PeerTicker = LOOKUPVALUE(Peers[Peer Code], Peers[Ticker Code], CurrentTicker, BLANK())
RETURN
IF(ISBLANK(PeerTicker), BLANK(),
    CALCULATE(
        SUM(Fact_Historical_Data[Value]),
        Fact_Historical_Data[Ticker Code] = PeerTicker,
        Fact_Historical_Data[Period] = LatestPeriod
    )
)&lt;/LI-CODE&gt;&lt;P&gt;Could you pls give a hint here.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 10:57:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3553915#M136751</guid>
      <dc:creator>oanu</dc:creator>
      <dc:date>2023-11-27T10:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of partner ticker</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3554290#M136785</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="652301" data-lia-user-login="oanu" class="lia-mention lia-mention-user"&gt;oanu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any chance you can upload the PBIX to Google Drive and share the link in this thread?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S.&amp;nbsp; If not, would it be possible to create a PBIX with a small amount of mock data that should work?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 13:52:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3554290#M136785</guid>
      <dc:creator>WinterMist</dc:creator>
      <dc:date>2023-11-27T13:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of partner ticker</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3555030#M136815</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="652301" data-lia-user-login="oanu" class="lia-mention lia-mention-user"&gt;oanu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering if this has to do with the data.&lt;/P&gt;&lt;P&gt;What happens if you remove the Alternate_Result parameter from VAR PeerTicker and simply return the VAR PeerTicker?&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;Your ALTERNATE RESULT = BLANK().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&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;If it throws an error, that would tell me that more than one value is getting returned.&lt;/P&gt;&lt;P&gt;(And if you're getting more than one value, that makes sense why the entire measure is returning BLANK all the time.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 20:36:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3555030#M136815</guid>
      <dc:creator>WinterMist</dc:creator>
      <dc:date>2023-11-27T20:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of partner ticker</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3556509#M136913</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for support. I decided to move column "Peer Code" to Dim_Assets Table and also adjusted the "Peer Current Value" measure as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Peer Current Value = 
VAR LatestPeriod = LASTDATE('Fact_Historical_Data'[Period])
VAR PeerTicker = SELECTEDVALUE(Dim_Assets[Peer Code])
RETURN
IF(
    ISBLANK(PeerTicker),
    BLANK(),
    CALCULATE(
        SUM(Fact_Historical_Data[Value]),
        All(Fact_Historical_Data),
        Fact_Historical_Data[Ticker Code] = PeerTicker,
        Fact_Historical_Data[Period] = LatestPeriod
    )
)&lt;/LI-CODE&gt;&lt;P&gt;So I added filter "All(Fact_Historical_Data)" and now it works.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2023 13:15:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-value-of-partner-ticker/m-p/3556509#M136913</guid>
      <dc:creator>oanu</dc:creator>
      <dc:date>2023-11-28T13:15:41Z</dc:date>
    </item>
  </channel>
</rss>

