<?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: DAX measure for returning specific values corresponding to slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650388#M78106</link>
    <description>&lt;LI-CODE lang="csharp"&gt;Supplier Name = 
var SupplierNames =
    CALCULATETABLE(
        summarize(
            'Fact_Kontrolregister_A_&amp;amp;_D',
            VirkMain[navn]
        ),
        keepfilters(
            'Fact_Kontrolregister_A_&amp;amp;_D'[cvr_HL/UL?]
                = "Hovedleverandør"
        )
    )
var Result =
    if( countrows( SupplierNames ) = 1,
        SupplierNames
    )
return
    Result


Supplier ID =
var SupplierIds =
    CALCULATETABLE(
        summarize(
            'Fact_Kontrolregister_A_&amp;amp;_D',
            VirkMain[cvrNummer]
        ),
        keepfilters(
            'Fact_Kontrolregister_A_&amp;amp;_D'[cvr_HL/UL?] = "Hovedleverandør"
        )
    )
var Result =
    if( countrows( SupplierIds ) = 1,
        SupplierIds
    )
return
    Result
&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 20 Jul 2022 12:35:42 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-07-20T12:35:42Z</dc:date>
    <item>
      <title>DAX measure for returning specific values corresponding to slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650126#M78093</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still pretty new to Power BI.&lt;BR /&gt;I am building a report that first of all is used for searching values and returning corresponding values in a matrix/table to create an overview over supplier contracts, suppliers and the suppliers' ID's.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The two tables I am using is a Contract Fact table &lt;STRONG&gt;"Fact_Kontrolregister_A_&amp;amp;_D"&lt;/STRONG&gt; containing a contract name &lt;STRONG&gt;(aftalenavn)&lt;/STRONG&gt; and a supplier ID&lt;STRONG&gt; (cvrNummer)&lt;/STRONG&gt; as well as a Supplier Dim table &lt;STRONG&gt;"VirkMain"&lt;/STRONG&gt; containing all unique supplier ID's &lt;STRONG&gt;(cvrNummer)&lt;/STRONG&gt; as well as the supplier name &lt;STRONG&gt;(navn)&lt;/STRONG&gt;. There is a single-directional one-to-many relationship from VirkMain to&amp;nbsp;Fact_Kontrolregister_A_&amp;amp;_D with supplier ID (cvr) as the connecting key:&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;BR /&gt;In the example below I have a supplier contract slicer and a table that ought to show the supplier and supplier ID corresponding to the selected supplier contract. I am able to return the supplier name (left side) but I fail to return the supplier ID (right side)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The two measures I use are much alike, but only "Supplier Name" is working where "Supplier ID" does not return a value:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Supplier Name = 
CALCULATE(
    MAX(VirkMain[navn]),
        FILTER(
            'Fact_Kontrolregister_A_&amp;amp;_D',
            'Fact_Kontrolregister_A_&amp;amp;_D'[aftalenavn] = _Measures[Selected Aftalenavn]),
            FILTER(
                'Fact_Kontrolregister_A_&amp;amp;_D',
                'Fact_Kontrolregister_A_&amp;amp;_D'[cvr_HL/UL?] = "Hovedleverandør")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Supplier ID = 
CALCULATE(
    MAX(VirkMain[cvrNummer]),
        FILTER(
            'Fact_Kontrolregister_A_&amp;amp;_D',
            'Fact_Kontrolregister_A_&amp;amp;_D'[aftalenavn] = _Measures[Selected Aftalenavn]),
            FILTER(
                'Fact_Kontrolregister_A_&amp;amp;_D',
                'Fact_Kontrolregister_A_&amp;amp;_D'[cvr_HL/UL?] = "Hovedleverandør")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how to make the second measure work?&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Magnus&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 10:43:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650126#M78093</guid>
      <dc:creator>Magnus-CPH-DK</dc:creator>
      <dc:date>2022-07-20T10:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for returning specific values corresponding to slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650388#M78106</link>
      <description>&lt;LI-CODE lang="csharp"&gt;Supplier Name = 
var SupplierNames =
    CALCULATETABLE(
        summarize(
            'Fact_Kontrolregister_A_&amp;amp;_D',
            VirkMain[navn]
        ),
        keepfilters(
            'Fact_Kontrolregister_A_&amp;amp;_D'[cvr_HL/UL?]
                = "Hovedleverandør"
        )
    )
var Result =
    if( countrows( SupplierNames ) = 1,
        SupplierNames
    )
return
    Result


Supplier ID =
var SupplierIds =
    CALCULATETABLE(
        summarize(
            'Fact_Kontrolregister_A_&amp;amp;_D',
            VirkMain[cvrNummer]
        ),
        keepfilters(
            'Fact_Kontrolregister_A_&amp;amp;_D'[cvr_HL/UL?] = "Hovedleverandør"
        )
    )
var Result =
    if( countrows( SupplierIds ) = 1,
        SupplierIds
    )
return
    Result
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Jul 2022 12:35:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650388#M78106</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-07-20T12:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for returning specific values corresponding to slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650663#M78125</link>
      <description>&lt;P&gt;Thanks a lot,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="349489" data-lia-user-login="daXtreme" class="lia-mention lia-mention-user"&gt;daXtreme&lt;/a&gt;&amp;nbsp;.&lt;BR /&gt;The first measure Supplier Name that you wrote works properly and returns the same value as the Supplier Name measure that I wrote.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the Supplier ID measure that you wrote seems to return blank values just as my Supplier ID measure.&lt;BR /&gt;&lt;BR /&gt;I have tried troubleshooting a bit and created a couple of measures more and inserted them in the table alongside a couple of columns which holds the same values as the measures I am trying to get to work.&lt;/P&gt;&lt;P&gt;Furthermore, I have made a matrix which among others shows the Supplier Name and Supplier ID at the top of the matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;"Supplier Name" is the same measure you and I worte - Works just fine&lt;/LI&gt;&lt;LI&gt;'VirkMain'[cvrNummer] is the Supplier ID columns from the Supplier table - Works in the table, however, it cannot find the accurate value in the matrix (it returns different values depending on if I return Sum, Min, Max and so on).&lt;/LI&gt;&lt;LI&gt;"Sum of Supplier ID" is the measure I cannot get to work. If i mark it with "Don't summarize" the whole table shows blank values.&lt;/LI&gt;&lt;LI&gt;"Supplier Branchetekst" is a test measure made in the same way as the other 2, which holds a text value from the supplier table - works just fine.&lt;/LI&gt;&lt;LI&gt;"Supplier Enhedsnummmer" is a test measure made in the same way as the other 2, which holds a numeric value from the supplier table - works just fine.&lt;/LI&gt;&lt;LI&gt;'Virkmain'[branchetekst] is a column from the Supplier table that holds an additional text value of a supplier - works just fine&lt;/LI&gt;&lt;LI&gt;And finally,&amp;nbsp;'Virkmain'[enhedsNummer] is a columns from the&amp;nbsp;Supplier table that holds an additional numeric value of a supplier - works just fine. Returns the same value as the "Supplier Enhedsnummer" measure.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Conclusion: The table is able to return the values I am looking for, whether text or nomeric and whether they are made as measures or coumns from the Supplier table. The only outlier is the Supplier ID (cvrNummer) which is the connecting key between the two tables. The Supplier ID measure is the only measure which has a small Sum sign (the sigma sign) next to it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the matrix visual does not show the correct Supplier ID if I include it as a columns value, I still need to fix the Supplier ID measure.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:05:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650663#M78125</guid>
      <dc:creator>Magnus-CPH-DK</dc:creator>
      <dc:date>2022-07-20T14:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for returning specific values corresponding to slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650686#M78126</link>
      <description>&lt;LI-CODE lang="csharp"&gt;Supplier ID =
var SupplierId =
    calculate(
        // Just take the supplier id from the fact table
        // instead of from the dimension...
        SELECTEDVALUE( 'Fact_Kontrolregister_A_&amp;amp;_D'[cvrNumber] ),
        keepfilters(
            'Fact_Kontrolregister_A_&amp;amp;_D'[cvr_HL/UL?] = "Hovedleverandør"
        )
    )
return
    SupplierId&lt;/LI-CODE&gt;&lt;P&gt;The id's must be same in both the dim table and the fact if they are joined on this field. But I don't understand why one of the formulas does return the correct answer but the other doesn't. This is pretty weird. There must be something going on with your data, I presume. But can't be sure since have no access to it... Try the above.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:12:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2650686#M78126</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-07-20T14:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for returning specific values corresponding to slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2655112#M78427</link>
      <description>&lt;P&gt;Thanks again,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="349489" data-lia-user-login="daXtreme" class="lia-mention lia-mention-user"&gt;daXtreme&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is a bit embarassing... the small sigma sign next to the measure was there because I somehow created a column instead of a measure. I didn't think that was even possible, when it is not connected to a table. Probably the reason I didn't take notice.&lt;BR /&gt;&lt;BR /&gt;Anyhow, both my code and yours work, so thanks again for helping me out!&lt;BR /&gt;Have a nice day,&lt;BR /&gt;Magnus&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 08:19:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-returning-specific-values-corresponding-to/m-p/2655112#M78427</guid>
      <dc:creator>Magnus-CPH-DK</dc:creator>
      <dc:date>2022-07-22T08:19:40Z</dc:date>
    </item>
  </channel>
</rss>

