Forum Discussion

Thigs's avatar
Thigs
Helper IV
4 years ago
Solved

Multiple Selected Values in DAX Formula

Hi all! I am working on a data set involving what number of items can fit inside a box. I am trying to make it so we can have variable box sizes. Here's my formula (Calculated Column)   How Ma...
  • smpa01's avatar
    smpa01
    4 years ago

    Thigs  do you mean this?

    Measure = 
    VAR _heightItem =
        MAX ( 'item'[Height] )
    VAR _lengthItem =
        MAX ( 'item'[Length] )
    VAR _widthItem =
        MAX ( 'item'[Width] )
    VAR _heightBox =
        CALCULATE (
            MAX ( box[Height] ),
            FILTER ( box, box[Box Type] = ALLSELECTED ( box[Box Type] ) )
        )
    VAR _lengthBox =
        CALCULATE (
            MAX ( box[Length] ),
            FILTER ( box, box[Box Type] = ALLSELECTED ( box[Box Type] ) )
        )
    VAR _widthBox =
        CALCULATE (
            MAX ( box[Width] ),
            FILTER ( box, box[Box Type] = ALLSELECTED ( box[Box Type] ) )
        )
    VAR _cal =
        INT ( DIVIDE ( _heightBox, _heightItem ) )
            * INT ( DIVIDE ( _lengthBox, _lengthItem ) )
            * INT ( DIVIDE ( _widthBox, _widthItem ) )
    RETURN
        _cal

     

    pbix is attached