Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I extract data from shopify into Power BI. In doing so all my metrics work well except for shipping. In the below image you see shipping is applied to two items for one order. In reality the shipping is 5 total not 10. To compensate for this in dax I sum the shipping and devide it by the line items. However if a specific item is ordered twice this formula fails. Is there a way in dax or calculated column to have shipping only applied once per order. Rather than per line item.
Thanks in advance,
Solved! Go to Solution.
Create a New Column with the below formula
Shipping Cost per Line =
Var ShippingID = ShippingTable[ShippingID]
Var nbrOfLines = CALCULATE(
COUNT(ShippingTable[ShippingID])
, ALL(ShippingTable)
, ShippingTable[ShippingID] = ShippingID
)
RETURN
DIVIDE(ShippingTable[Shipping] , nbrOfLines)
Create a New Column with the below formula
Shipping Cost per Line =
Var ShippingID = ShippingTable[ShippingID]
Var nbrOfLines = CALCULATE(
COUNT(ShippingTable[ShippingID])
, ALL(ShippingTable)
, ShippingTable[ShippingID] = ShippingID
)
RETURN
DIVIDE(ShippingTable[Shipping] , nbrOfLines)
Is there any way to distinguish betweendistinguish between these two scenarios?
could you pls paste the sample data ane expected output?
Proud to be a Super User!
User | Count |
---|---|
84 | |
75 | |
69 | |
48 | |
39 |
User | Count |
---|---|
111 | |
56 | |
50 | |
42 | |
40 |