<?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 Measure to filter on slicer selection in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3455963#M131737</link>
    <description>&lt;P&gt;I am trying to calculate a measure based on the selected value of a slicer.&amp;nbsp; I have two tables 'STD Hours - SAP' and 'Worked Hours' with a relationship on line detail between the two.&amp;nbsp; I want the measure to take the value of the selected 'Line Detail' and calculate a measure on the filtered value.&amp;nbsp; For instance, if user selects "WD Cell 4 (TO021119/120)", then sum all of the hours earned for that line detail (from 'STD Hours - SAP') and divide out the worked hours (from 'Worked Hours') for that line detail (see below):&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;&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;P&gt;I can get the measure to work with the following DAX:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;DLE = IFERROR(SUM('STD Hours - SAP'[HMOD Earned])/CALCULATE(SUM('Worked Hours'[Hours]),'Worked Hours'[Line Detail] = "WD Cell 4 (TO021119/120)"), "N/A")&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but not dynamically based on the slicer selection.&amp;nbsp; I have searched and found similar posts but can't figure out how to write it, not sure what I am missing.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any help you can provide is greatly appreciated!&amp;nbsp; Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 02 Oct 2023 13:11:40 GMT</pubDate>
    <dc:creator>BIGDADE5000</dc:creator>
    <dc:date>2023-10-02T13:11:40Z</dc:date>
    <item>
      <title>Measure to filter on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3455963#M131737</link>
      <description>&lt;P&gt;I am trying to calculate a measure based on the selected value of a slicer.&amp;nbsp; I have two tables 'STD Hours - SAP' and 'Worked Hours' with a relationship on line detail between the two.&amp;nbsp; I want the measure to take the value of the selected 'Line Detail' and calculate a measure on the filtered value.&amp;nbsp; For instance, if user selects "WD Cell 4 (TO021119/120)", then sum all of the hours earned for that line detail (from 'STD Hours - SAP') and divide out the worked hours (from 'Worked Hours') for that line detail (see below):&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;&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;P&gt;I can get the measure to work with the following DAX:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;DLE = IFERROR(SUM('STD Hours - SAP'[HMOD Earned])/CALCULATE(SUM('Worked Hours'[Hours]),'Worked Hours'[Line Detail] = "WD Cell 4 (TO021119/120)"), "N/A")&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but not dynamically based on the slicer selection.&amp;nbsp; I have searched and found similar posts but can't figure out how to write it, not sure what I am missing.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any help you can provide is greatly appreciated!&amp;nbsp; Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 Oct 2023 13:11:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3455963#M131737</guid>
      <dc:creator>BIGDADE5000</dc:creator>
      <dc:date>2023-10-02T13:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to filter on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3458687#M131871</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="624617" data-lia-user-login="BIGDADE5000" class="lia-mention lia-mention-user"&gt;BIGDADE5000&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You can update the formula of measure [DLE] as below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DLE = 
VAR SelectedLineDetail = SELECTEDVALUE('Worked Hours'[Line Detail])
RETURN
IFERROR(
    SUM('STD Hours - SAP'[HMOD Earned]) / 
    CALCULATE(SUM('Worked Hours'[Hours]), 'Worked Hours'[Line Detail] = SelectedLineDetail),
    "N/A"
)&lt;/LI-CODE&gt;
&lt;P&gt;Remember, this method assumes that your slicer is single-select. If multiple selections are allowed in your slicer, you might need to adjust your approach accordingly as below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DLE =
VAR SelectedLineDetails =
    ALLSELECTED ( 'Worked Hours'[Line Detail] )
RETURN
    IFERROR (
        SUM ( 'STD Hours - SAP'[HMOD Earned] )
            / CALCULATE (
                SUM ( 'Worked Hours'[Hours] ),
                'Worked Hours'[Line Detail] IN SelectedLineDetails
            ),
        "N/A"
    )&lt;/LI-CODE&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 03:36:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3458687#M131871</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-04T03:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to filter on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3459471#M131932</link>
      <description>&lt;P&gt;Thank you so much, Rena!&amp;nbsp; It made total sense once I saw your recommendation.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 12:38:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3459471#M131932</guid>
      <dc:creator>BIGDADE5000</dc:creator>
      <dc:date>2023-10-04T12:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to filter on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3469715#M132463</link>
      <description>&lt;P&gt;How would you propose to show all the values in a multi-row card?&amp;nbsp; The DAX, you provided, works great but I am trying to expand it now.&amp;nbsp; I want to show the 'DLE' for all lines on a multi-row card.&lt;BR /&gt;Should I open another topic?&amp;nbsp; Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 20:06:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-filter-on-slicer-selection/m-p/3469715#M132463</guid>
      <dc:creator>BIGDADE5000</dc:creator>
      <dc:date>2023-10-10T20:06:37Z</dc:date>
    </item>
  </channel>
</rss>

