Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ehrreich21
Helper I
Helper I

Box Size help

I have a column for UOM_LENGTH, UOM_WIDTH, UOM_HEIGHT with a large set of data, I want to see what box size each item would ship in, with the below table showing the available sizes. My goal is the product would ship in the box based on the measurements. The length, width, and height do not correlate so since it's user inputted. I wanted to add a new column to the dataset that will tell me the box size with the letter. Any help would be greatly appreciated.

 

Box Sizes ( all in pallet counts) Box Type
9.5x6.5x3 - F
15 X 10 X 4 - G
8x8x4 - H
12x8x4 - I
12x8x8 - J
19x14x4 - L
19x14x8 - N
19x14x12 - P
24 X 14 X 4 - U
24x16x16 - S

 

1 ACCEPTED SOLUTION

@ehrreich21 - Eh, got bored, just went ahead and did it:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Box-Sizes/td-p/1356883

 

That DAX attempt without testing from memory was trash anyway.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@ehrreich21 - I solved this once before, which I could find that formula, I believe you will need height, width and length in separate columns along with box size. You would then want a Volume calculated column like this:

Volume (Column) = [Height] * [Width] * [Length]

Then you need to do this.

Box Size (Column) =
  VAR __UserMeasure1 = MINX( {[userheight],[userwidth],[userlength]},[Value])
  VAR __UserMeasure2 = MINX( EXCEPT({[userheight],[userwidth],[userlength]},{__Measure1}),[Value])
  VAR __UserMeasure3 = MINX( EXCEPT({[userheight],[userwidth],[userlength]},{__Measure1, __Measure2}),[Value])
  VAR __BoxTable =
    ADDCOLUMNS(
      ADDCOLUMNS(
        ADDCOLUMNS(
          'Box Sizes',
          "__Measure1"=MINX( {[Height],[Width],[Length]},[Value]),
        ),
        "__Measure2"=MINX( EXCEPT({[Height],[Width],[Length]},{[__Measure1]}),[Value]),
      ),
      "__Measure3"=MINX( EXCEPT({[Height],[Width],[Length]},{[__Measure1],[__Measure2]}),[Value])
    )
  VAR __Table = 
    FILTER(
      ADDCOLUMNS(
        __BoxTable,
        "Fit1",IF(__UserMeasure1<[__Measure1],1,0),
        "Fit2",IF(__UserMeasure2<[__Measure2],1,0),
        "Fit3",IF(__UserMeasure3<[__Measure3],1,0)
      ),
      [Fit1]=1 && [Fit2]=1 && [Fit3]=1
    )
  VAR __MinBoxVolume = MINX(__Table,[Volume])
RETURN
  MAXX(FILTER(__Table,[Volume]=__MinBoxVolume),[Size])

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Not sure I follow, I currently have these columns now in my table. I would like it to add a column of the correct box size to use as the new column

 

ehrreich21_0-1599602892269.png

 

@ehrreich21 - Eh, got bored, just went ahead and did it:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Box-Sizes/td-p/1356883

 

That DAX attempt without testing from memory was trash anyway.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@ehrreich21 - Paste that data as text in a table and I'll write up a specific implementation for you. Are you showing user transactions table there? I will need that. You will also want a table with your box sizes broken out into height, width and length. I hate typing data. Please make sure to @ me in response otherwise I'll probably lose the thread.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.