Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi everyone 🙂
I want to create a measure to calculate total shipping costs, based on unique Order ID. I am using a star schema, so Order ID is not unique.
The main issue is Freight (shipping costs) is also not unique, so whenever I use SUM(), it sums everything, which is not what I want.
My attempt:
Total Freight := CALCULATE(SUM('Orders'[Freight], DISTINCT('Orders'[Order ID]) --which ended up being the same as SUM('Orders'[Freight])
I got $107K but should be getting $32K. Please help ^^'
I'll attach some screenshots.
Solved! Go to Solution.
@rqh
Try this measure:
Total Freight =
SUMX (
DISTINCT('Orders'[Order ID]),
CALCULATE ( MAX( 'Orders'[Freight] ) )
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@rqh
Try this measure:
Total Freight =
SUMX (
DISTINCT('Orders'[Order ID]),
CALCULATE ( MAX( 'Orders'[Freight] ) )
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Great solution, you're a godsend.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
80 | |
76 | |
61 | |
36 | |
32 |
User | Count |
---|---|
91 | |
60 | |
59 | |
49 | |
45 |