<?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 Summarize output of dynamic measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-output-of-dynamic-measure/m-p/1935034#M42070</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am having following problem: I try to dynamically categorise skus to a specific bin type based on their size metrics. The available bin types change dynamically so I created a dropdown list to select the bin types which should be taken into consideration in the measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following measure is used to categorise the SKUs:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;BinTypeMeasure =&lt;BR /&gt;VAR SKU_Vol = SELECTEDVALUE (SKU[Repl_Vol])&lt;BR /&gt;Var length = SELECTEDVALUE(SKU[Length])&lt;BR /&gt;Var width = SELECTEDVALUE(SKU[Width])&lt;BR /&gt;Var Height = SELECTEDVALUE(SKU[Height])&lt;BR /&gt;VAR Boundary = SELECTCOLUMNS( TOPN ( 1, FILTER ( ALLSELECTED(Bin_Types), Bin_types[Volume]&amp;gt;= SKU_Vol &amp;amp;&amp;amp; Bin_types[Height]&amp;gt;= Height &amp;amp;&amp;amp; Bin_types[Width]&amp;gt;=width &amp;amp;&amp;amp; Bin_types[Length]&amp;gt;= length), Bin_types[Volume], ASC),"Result",Bin_Types[Bin type])&lt;BR /&gt;Return&lt;BR /&gt;Boundary&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Unfortunately this measure returns the output on SKU basis only&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;What I want however is a count of BinTypeMeasure, to stick to the example above something like this:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;S06&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B06&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the powerBI file is needed feel free to contact me&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 02 Jul 2021 09:45:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-07-02T09:45:09Z</dc:date>
    <item>
      <title>Summarize output of dynamic measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-output-of-dynamic-measure/m-p/1935034#M42070</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am having following problem: I try to dynamically categorise skus to a specific bin type based on their size metrics. The available bin types change dynamically so I created a dropdown list to select the bin types which should be taken into consideration in the measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following measure is used to categorise the SKUs:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;BinTypeMeasure =&lt;BR /&gt;VAR SKU_Vol = SELECTEDVALUE (SKU[Repl_Vol])&lt;BR /&gt;Var length = SELECTEDVALUE(SKU[Length])&lt;BR /&gt;Var width = SELECTEDVALUE(SKU[Width])&lt;BR /&gt;Var Height = SELECTEDVALUE(SKU[Height])&lt;BR /&gt;VAR Boundary = SELECTCOLUMNS( TOPN ( 1, FILTER ( ALLSELECTED(Bin_Types), Bin_types[Volume]&amp;gt;= SKU_Vol &amp;amp;&amp;amp; Bin_types[Height]&amp;gt;= Height &amp;amp;&amp;amp; Bin_types[Width]&amp;gt;=width &amp;amp;&amp;amp; Bin_types[Length]&amp;gt;= length), Bin_types[Volume], ASC),"Result",Bin_Types[Bin type])&lt;BR /&gt;Return&lt;BR /&gt;Boundary&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Unfortunately this measure returns the output on SKU basis only&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;What I want however is a count of BinTypeMeasure, to stick to the example above something like this:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;S06&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B06&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the powerBI file is needed feel free to contact me&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 02 Jul 2021 09:45:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-output-of-dynamic-measure/m-p/1935034#M42070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-02T09:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Summarize output of dynamic measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-output-of-dynamic-measure/m-p/1936227#M42112</link>
      <description>&lt;LI-CODE lang="csharp"&gt;[BinType Count] =
switch( true(),
    ISINSCOPE( Bin_Types[Bin Type] ),
        var BinType_ = SELECTEDVALUE( Bin_Types[Bin Type] )
        return
        COUNTROWS(
            FILTER(
                DISTINCT( SKU[SKU] ),
                [BinTypeMeasure] = BinType_
            )
        ),
    
    // If we're on a total row or
    // if there's no bin type in scope...
    SUMX(
        ALLSELECTED( Bin_Types ),
        var BinType_ = Bin_Types[Bin Type]
        return
        COUNTROWS(
            FILTER(
                DISTINCT( SKU[SKU] ),
                [BinTypeMeasure] = BinType_
            )
        )
    )
)


// Version 2: might be faster...
[BinType Count ver.2] =
var BinTypesWithCounts = 
    CALCULATETABLE(
        ADDCOLUMNS(
            VALUES( Bin_Types[Bin Type] ),
            "@Count",
                var BinType_ = Bin_Types[Bin Type]
                return
                COUNTROWS(
                    FILTER(
                        DISTINCT( SKU[SKU] ),
                        [BinTypeMeasure] = BinType_
                    )
                )
        ),
        ALLSELECTED( Bin_Types )
    )
var Result =
    IF( ISINSCOPE( Bin_Types[Bin Type] ),
        var CurrentBinType =
            SELECTEDVALUE( Bin_Types[Bin Type] )
        return
            MAXX(
                FILTER(
                    BinTypesWithCounts,
                    Bin_Types[Bin Type] = CurrentBinType
                ),
                [@Count]
            ),
        SUMX(
            BinTypesWithCounts,
            [@Count]
        )
    )
return
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 03 Jul 2021 16:46:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-output-of-dynamic-measure/m-p/1936227#M42112</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-07-03T16:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Summarize output of dynamic measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-output-of-dynamic-measure/m-p/1938071#M42162</link>
      <description>&lt;P&gt;Works like a charm thank you four your help.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 12:48:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-output-of-dynamic-measure/m-p/1938071#M42162</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-05T12:48:19Z</dc:date>
    </item>
  </channel>
</rss>

