<?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: Box Sizes in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358483#M613</link>
    <description>&lt;P class="lia-align-left"&gt;Got it, let me take a peek.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 13:53:13 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2020-09-09T13:53:13Z</dc:date>
    <item>
      <title>Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1356883#M609</link>
      <description>&lt;P&gt;Here's a fun one brought to you&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;in &lt;A href="https://community.powerbi.com/t5/Desktop/Box-Size-help/m-p/1356200#M581775" target="_self"&gt;this thread&lt;/A&gt;. Have to admit, I love the business operations stuff the mostest! This handy little guy figures out the optimal box size for you automagically. Not really much more to say about it other than it's actually more complex than you would initially think! The complexity comes in because; trust me, we all know that customers lie and they tell you these lies straight-up to your face without any remose or regret what-so-ever. Like that a height is a width or a width is a length and so forth and so on. But I'm not bitter. Anyway, this was like the 2nd or 3rd time I think I have solved this particular riddle so figured I'd post it here for posterity!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Box Size = 
    VAR __Height = MAX(Orders[UOM_HEIGHT])
    VAR __Width = MAX(Orders[UOM_WIDTH])
    VAR __Length = MAX(Orders[UOM_LENGTH])
    VAR __UserMeasure1 = MINX( {__Height,__Width,__Length},[Value])
    VAR __UserMeasure2 = IF(__Height = __Width &amp;amp;&amp;amp; __Height = __Length,__Height,MINX( EXCEPT({__Height,__Width,__Length},{__UserMeasure1}),[Value]))
    VAR __UserMeasure3 = MAXX( {__Height,__Width,__Length},[Value])
    VAR __BoxTable =
        ADDCOLUMNS(
        ADDCOLUMNS(
            ADDCOLUMNS(
            'BoxSizes',
            "__Measure1",MINX( {[Height],[Width],[Length]},[Value])
            ),
            "__Measure2",IF([Height] = [Width] &amp;amp;&amp;amp; [Height] = [Length],[Height],MINX( EXCEPT({[Height],[Width],[Length]},{[__Measure1]}),[Value]))
        ),
        "__Measure3",MAXX( {[Height],[Width],[Length]},[Value])
        )
    VAR __Table1 = 
            ADDCOLUMNS(
            __BoxTable,
            "Fit1",IF(__UserMeasure1&amp;lt;=[__Measure1],1,0),
            "Fit2",IF(__UserMeasure2&amp;lt;=[__Measure2],1,0),
            "Fit3",IF(__UserMeasure3&amp;lt;=[__Measure3],1,0)
        )
    VAR __Table = 
        FILTER(
            __Table1,
            [Fit1]=1 &amp;amp;&amp;amp; [Fit2]=1 &amp;amp;&amp;amp; [Fit3]=1
        )
    VAR __MinBoxVolume = MINX(__Table,[Volume])
    RETURN
    MAXX(FILTER(__Table,[Volume]=__MinBoxVolume),[Size])&lt;/LI-CODE&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;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiMGRhM2NkZWQtMjEzNy00NDNmLWIxYzItMWMyYjc0YWI5Zjg2IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 04:50:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1356883#M609</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-09T04:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358467#M610</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't open your files as our powerbi is an older version. Anyway to save it down. Otherwise, I tried pasting it into mine and it shows nothing in the box size column, but I get no errors either. Also my file is to big to attach&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 13:44:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358467#M610</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-09T13:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358474#M611</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Hmm, here is my BoxSizes table, that's the name:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Orders table&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Hopefully that helps, maybe you could send me/post a PBIT and I could take a look and see? Not sure if that will work.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 13:49:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358474#M611</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-09T13:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358477#M612</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My file attached, I removed some stuff, but also this is older version so I can't be saved In new or I can't open it&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 13:52:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358477#M612</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-09T13:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358483#M613</link>
      <description>&lt;P class="lia-align-left"&gt;Got it, let me take a peek.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 13:53:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358483#M613</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-09T13:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358512#M614</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;- OK, first, you will need to create this column in BoxTable:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Volume = [Height]*[Length]*[Width]&lt;/LI-CODE&gt;
&lt;P&gt;Then you need to change your column formula to this in ITEM_MASTER (you do have some items that don't fit)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Box Size = 
    VAR __Height = ITEM_MASTER[UOM_HEIGHT]
    VAR __Width = ITEM_MASTER[UOM_WIDTH]
    VAR __Length = ITEM_MASTER[UOM_LENGTH]
    VAR __UserMeasure1 = MINX( {__Height,__Width,__Length},[Value])
    VAR __UserMeasure2 = IF(__Height = __Width &amp;amp;&amp;amp; __Height = __Length,__Height,MINX( EXCEPT({__Height,__Width,__Length},{__UserMeasure1}),[Value]))
    VAR __UserMeasure3 = MAXX( {__Height,__Width,__Length},[Value])
    VAR __BoxTable =
        ADDCOLUMNS(
        ADDCOLUMNS(
            ADDCOLUMNS(
            'BoxTable',
            "__Measure1",MINX( {[Height],[Width],[Length]},[Value])
            ),
            "__Measure2",IF([Height] = [Width] &amp;amp;&amp;amp; [Height] = [Length],[Height],MINX( EXCEPT({[Height],[Width],[Length]},{[__Measure1]}),[Value]))
        ),
        "__Measure3",MAXX( {[Height],[Width],[Length]},[Value])
        )
    VAR __Table1 = 
            ADDCOLUMNS(
            __BoxTable,
            "Fit1",IF(__UserMeasure1&amp;lt;=[__Measure1],1,0),
            "Fit2",IF(__UserMeasure2&amp;lt;=[__Measure2],1,0),
            "Fit3",IF(__UserMeasure3&amp;lt;=[__Measure3],1,0)
        )
    VAR __Table = 
        FILTER(
            __Table1,
            [Fit1]=1 &amp;amp;&amp;amp; [Fit2]=1 &amp;amp;&amp;amp; [Fit3]=1
        )
    VAR __MinBoxVolume = MINX(__Table,[Volume])
    RETURN
        MAXX(FILTER(__Table,[Volume]=__MinBoxVolume),[Size])&lt;/LI-CODE&gt;
&lt;P&gt;Part of the issue is you were using the measure form in a column form, but makes sense since you couldn't open the PBIX to see the column form.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 14:03:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358512#M614</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-09T14:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358548#M615</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got it! Thank you!&lt;/P&gt;
&lt;P&gt;Also we have a few that will be to big and just get a ship label! Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 14:18:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/1358548#M615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-09T14:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Box Sizes</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/2000338#M733</link>
      <description>&lt;P&gt;The concept is nice but the code for the middle value left me wanting a better way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a modification that uses TOPN to sort the measures:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Box Size = 
VAR __Height = MAX ( Orders[UOM_HEIGHT] )
VAR __Width  = MAX ( Orders[UOM_WIDTH] )
VAR __Length = MAX ( Orders[UOM_LENGTH] )
VAR UserMeasures = SELECTCOLUMNS ( { __Height, __Width, __Length }, "__UserMeasure", [Value] )
VAR MeasureRanks = SELECTCOLUMNS ( { 1, 2, 3 }, "__Rank", [Value] )
VAR BoxTable =
    ADDCOLUMNS (
        BoxSizes,
        "__Fit",
            VAR BoxMeasures = SELECTCOLUMNS ( { [Height], [Width], [Length] }, "__BoxMeasure", [Value] )
            VAR MatchRanks = /* Align measures in descending order */
                ADDCOLUMNS (
                    MeasureRanks,
                    "__BoxMeasure",  MINX ( TOPN ( [__Rank], BoxMeasures,  [__BoxMeasure]  ), [__BoxMeasure] ),
                    "__UserMeasure", MINX ( TOPN ( [__Rank], UserMeasures, [__UserMeasure] ), [__UserMeasure] )
                )
            RETURN
                MINX ( MatchRanks, IF ( [__UserMeasure] &amp;lt;= [__BoxMeasure], 1, 0 ) )
    )
VAR __MinBoxVolume = MINX ( FILTER ( BoxTable, [__Fit] = 1 ), [Height] * [Width] * [Length] )
RETURN
    MAXX ( FILTER ( BoxTable, [Volume] = __MinBoxVolume ), [Size] )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 Aug 2021 13:20:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Box-Sizes/m-p/2000338#M733</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-08-05T13:20:03Z</dc:date>
    </item>
  </channel>
</rss>

