Forum Discussion

Lucy_Ramirez's avatar
Lucy_Ramirez
Frequent Visitor
2 years ago

Assign price by higher weight

Hello!!!

I have two measures, one that calculates the weight of sales per item (%Weight) and another that calculates the unit price ($Unit Price)

I need to find a measure that assigns me a unit price for each item.

The unit price I need has to be the one with the highest % weight per item.

My database is the blue part, my measurements are the green part, and the measurements I need are the brown part.

 

I hope you can help me, thank you so much! 🙂 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Lucy_Ramirez  Does something like this work for you?

    MAX percentage =
    CALCULATE ( MAX ( Sheet1[Percentage] ), ALLEXCEPT ( Sheet1, Sheet1[Product] ) )

     

    MAX units =
    CALCULATE ( MAX ( Sheet1[Units] ), ALLEXCEPT ( Sheet1, Sheet1[Product] ) )

     

     

     

     

    • Lucy_Ramirez's avatar
      Lucy_Ramirez
      Frequent Visitor

      43.39Hello!

      No, I need to assign a price of the maximum weight.

      for example for tostada nachos, te maximum weight is 43.39%, so I need that in all article the price be $4.

       

      Any thoughts?

       

      Thankyou!

      • Anonymous's avatar
        Anonymous
        Not applicable

        Lucy_Ramirez Ashish_Mathur  is right. Calculated columns should be used.

        MAX percentage =
        MAXX (
            TOPN (
                1,
                FILTER ( Sheet1, Sheet1[Product] = EARLIER ( Sheet1[Product] ) ),
                Sheet1[Percentage]
            ),
            Sheet1[Percentage]
        )
         
        MAX units =
        MAXX (
            TOPN (
                1,
                FILTER ( Sheet1, Sheet1[Product] = EARLIER ( Sheet1[Product] ) ),
                Sheet1[Percentage]
            ),
            Sheet1[Units]
        )
         

        Thanks to wdx223_Daniel for the solution.

         
  • Hi,

    This should typically be solved with a calculated column formula in the Table.  If you are OK with my approach, then share the download link of the PBI file.  If possible, pleasure ensure that column names are in English.