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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Lucy_Ramirez
Frequent Visitor

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.

Lucy_Ramirez_0-1703801976975.png

 

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

4 REPLIES 4
Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
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] ) )

 

bchager6_2-1703805515886.png

 

 

 

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
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]
)
 
bchager6_0-1703824915750.png

Thanks to @wdx223_Daniel for the solution.

 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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