<?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: Use Parameter to Slice Aggregate Measure? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3715828#M144626</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are two methods:&lt;/P&gt;
&lt;P&gt;The first one is to use the field parameter:&lt;/P&gt;
&lt;P&gt;I create a set of sample data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then add two measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;N = 
CALCULATE (
    SUM ( 'Table (2)'[daysonjob] ),
    FILTER ( ALLSELECTED ( 'Table (2)' ), 'Table (2)'[laboronsite] = "N" )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Y = 
CALCULATE (
    SUM ( 'Table (2)'[daysonjob] ),
    FILTER ( ALLSELECTED ( 'Table (2)' ), 'Table (2)'[laboronsite] = "Y" )
)&lt;/LI-CODE&gt;
&lt;P&gt;Add the two measure as parameter:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;The result is as follow:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second method:&lt;/P&gt;
&lt;P&gt;Create a new table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table = {"Y","N"}&lt;/LI-CODE&gt;
&lt;P&gt;Then add a measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _Newvalue = SELECTEDVALUE('Table'[Value])
VAR _labor = SWITCH(
    _Newvalue,
    "Y","Y",
    "N","N"
)
RETURN     
    CALCULATE (
        SUM ( 'Table (2)'[daysonjob] ),
        FILTER ( ALLSELECTED ( 'Table (2)' ), 'Table (2)'[laboronsite] = _labor )
    )&lt;/LI-CODE&gt;
&lt;P&gt;Create a slicer with table[value] and a card with the measure:&lt;/P&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2024 03:29:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-02-22T03:29:54Z</dc:date>
    <item>
      <title>Use Parameter to Slice Aggregate Measure?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3715172#M144595</link>
      <description>&lt;P&gt;Hello all -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based off the below dataset, I have summed the 'daysonjob' column on my dashboard. Is there a way to filter or slice that aggregation based off a parameter within DAX?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example - If a parameter is selected as "all", I would like to see the sum of the entire column 'daysonjob'. If the parameter is selected as 'remove days off site,' I would like to see the sum of 'daysonjob' where 'laboronsite' = 'Y'.&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;Essentially, I want the user to be able to select 'Days On Job' as&amp;nbsp;&lt;EM&gt;all days the job has been active&lt;/EM&gt; or &lt;EM&gt;only days where labor was actually on site&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible? From my memory, this can be easily achieved in Tableau, but I can't seem to figure out how to write a DAX measure with parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 21:44:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3715172#M144595</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-21T21:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Use Parameter to Slice Aggregate Measure?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3715608#M144619</link>
      <description>&lt;P&gt;yes, prepare separate measures and then add them all to the same field parameter.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 01:51:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3715608#M144619</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-02-22T01:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use Parameter to Slice Aggregate Measure?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3715828#M144626</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are two methods:&lt;/P&gt;
&lt;P&gt;The first one is to use the field parameter:&lt;/P&gt;
&lt;P&gt;I create a set of sample data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then add two measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;N = 
CALCULATE (
    SUM ( 'Table (2)'[daysonjob] ),
    FILTER ( ALLSELECTED ( 'Table (2)' ), 'Table (2)'[laboronsite] = "N" )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Y = 
CALCULATE (
    SUM ( 'Table (2)'[daysonjob] ),
    FILTER ( ALLSELECTED ( 'Table (2)' ), 'Table (2)'[laboronsite] = "Y" )
)&lt;/LI-CODE&gt;
&lt;P&gt;Add the two measure as parameter:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;The result is as follow:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second method:&lt;/P&gt;
&lt;P&gt;Create a new table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table = {"Y","N"}&lt;/LI-CODE&gt;
&lt;P&gt;Then add a measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _Newvalue = SELECTEDVALUE('Table'[Value])
VAR _labor = SWITCH(
    _Newvalue,
    "Y","Y",
    "N","N"
)
RETURN     
    CALCULATE (
        SUM ( 'Table (2)'[daysonjob] ),
        FILTER ( ALLSELECTED ( 'Table (2)' ), 'Table (2)'[laboronsite] = _labor )
    )&lt;/LI-CODE&gt;
&lt;P&gt;Create a slicer with table[value] and a card with the measure:&lt;/P&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 03:29:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3715828#M144626</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-22T03:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use Parameter to Slice Aggregate Measure?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3717394#M144715</link>
      <description>&lt;P&gt;This is helpful, thank you!&amp;nbsp;One more thing I did not explain. I need the aggregate measure to also act as the denominator in an equation. It appears I am not able to reference the Parameter in a DAX statement as a denominator. I created the below measure, and it seems to work as the denominator in a DAX statement.&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;DOJ_PARAMETER_VALUE = 
VAR __SelectedValue =
    SELECTCOLUMNS (
        SUMMARIZE ( 'Days On Job Parameter', 'Days On Job Parameter'[Days On Job Parameter], 'Days On Job Parameter'[Days On Job Parameter Fields] ),
        'Days On Job Parameter'[Days On Job Parameter]
    )
RETURN IF ( COUNTROWS ( __SelectedValue ) = 1, __SelectedValue )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Feb 2024 14:42:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-Parameter-to-Slice-Aggregate-Measure/m-p/3717394#M144715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-22T14:42:10Z</dc:date>
    </item>
  </channel>
</rss>

