Forum Discussion

Steve123's avatar
Steve123
Frequent Visitor
3 years ago

Use measure in Iterator

Aplogies if this looks like a re-post, I initially accidentally put in under "Community".

 

Relatively new to Power BI and trying to do things that are easy in Excel (guessing I'm not the only one...)

 

I have a table of items a company sells with item dimensions.

 

I'm looking for how many items will fit in a tote (storage box), so that we can best figure out what size tote to use.

 

I have created a measure called Available Volume, based on height, width, length and percentage fill and have these values on sliders, so I can show available volume as a value:

 

 

 

 

I can iterate through all items if I hardcode the tote size into the DAX measure:

 

Items per Tote =
SUMX(
    'Week 36',
    ROUNDDOWN(
        DIVIDE(
            40,
            'Week 36'[Item Volume]
       ),
       0
    )
)
 
Giving:

 

 

Yet referencing the Volume of Tote Meause in the iterator blanks out all records in the visual:
Items per Tote =
SUMX(
    'Week 36',
    ROUNDDOWN(
        DIVIDE(
            [Available Volume],
            'Week 36'[Item Volume]
       ),
       0
    )
)
 

 

 

 So, how do I reference Available Volume in that iterator? Is my problem because it isn't related to my table?

4 Replies

  • try this:

     

    Items per Tote =
    VAR AvailableVolume =  [Available Volume]
    RETURN
        SUMX(
            'Week 36',
             ROUNDDOWN(
                  DIVIDE(
                      AvailableVolume,
                      'Week 36'[Item Volume]
                  ),
              0
            )
         )
    • Steve123's avatar
      Steve123
      Frequent Visitor

      Thanks for the response. 

      However, I get the same problem, with it returning blanks

       

      For info, this works, but is still hardcoding it:

      Items per Tote =
      VAR AvailableVolume = 40
      RETURN
          SUMX(
              'Week 36',
              ROUNDDOWN(
                  DIVIDE(
                      AvailableVolume,
                      'Week 36'[Item Volume]
                  ),
                  0
              )
          )
      • FreemanZ's avatar
        FreemanZ
        Icon for Super User rankSuper User

        May i see your definition of the measure [Available Volume]?