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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Akashbadakh94
New Member

Need to Swap values in columns

We have Unit price with us for various items

Need to calculate actual and weightage by dax

Actual - divide (unit price/total unit price)
Weightage is flipped- lowest of actual is assigned to highest unit price. Second lowest actual to second highest unit price and so on..wieghtage.jpg

 Weightage is the Final output needed

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Source Data

Rakesh1705_0-1722179090696.png

Actual Calculation

Rakesh1705_1-1722179122125.png

Rank in Descending Order

Rakesh1705_2-1722179148453.png

Rank in Ascending order

Rakesh1705_3-1722179167240.png

Weightage

Rakesh1705_4-1722179186046.png

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Source Data

Rakesh1705_0-1722179090696.png

Actual Calculation

Rakesh1705_1-1722179122125.png

Rank in Descending Order

Rakesh1705_2-1722179148453.png

Rank in Ascending order

Rakesh1705_3-1722179167240.png

Weightage

Rakesh1705_4-1722179186046.png

 

twi1
Frequent Visitor

Calculate Actual as the ratio of Unit Price to the total Unit Price
Actual =
DIVIDE(
Items[Unit Price],
CALCULATE(SUM(Items[Unit Price]), ALL(Items))
)

 Rank Unit Prices in descending order
UnitPriceRank =
RANKX(
ALL(Items),
Items[Unit Price],
,
DESC,
DENSE
)

 Rank Actual values in ascending order
ActualRank =
RANKX(
ALL(Items),
Items[Actual],
,
ASC,
DENSE
)

 Assign Weightage by matching the ranks of UnitPriceRank and ActualRank
Weightage =
CALCULATE(
MAXX(
FILTER(
ALL(Items),
Items[ActualRank] = Items[UnitPriceRank]
),
Items[Actual]
)
Let me know if it helped you a bit and if you need further assistance or have any questions!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.