The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a table in Power BI showing orders and their shipping times. One column is called Shipping Method and contains values like same-day, first class, standard etc. Other columns are 'Order Date' and 'Shipping Date'.
I have calculated the shipping time in days by creating a calculated column called "Shipping Time" and deducting the order date from the shipping date. For Same Day shipping, then, the calculated value should be 0 as the shipping date should be the same as the order date.
I would like to create a measure that counts the number of rows where the following conditions are satisfied: Shipping Method is "Same Day" AND Shipping Time is >0. However, I can't see any obvious ways to do this and I'm not experienced enough in DAX without any help.
I can use the filters on my table to satisfy the above conditions, but I would like the measure to display the total count of same day "fails" and update when refreshed with new data.
Please could someone help me?
Thank you in advance.
Debbie
Solved! Go to Solution.
Please try something like this for your Measure:
SameDay_Late = CALCULATE( COUNT( YourTable[OrderID]),
FILTER( YourTable,
YourTable[ShippingMethod] = "Same Day" &&
YourTable[ShippingTime] > 0 ))
This assumes [OrderId] is numeric. If it is text use COUNTA.
Hope this gets you where you need to go.
Regards,
That has worked perfectly! Thank you very much. 🙂
Please try something like this for your Measure:
SameDay_Late = CALCULATE( COUNT( YourTable[OrderID]),
FILTER( YourTable,
YourTable[ShippingMethod] = "Same Day" &&
YourTable[ShippingTime] > 0 ))
This assumes [OrderId] is numeric. If it is text use COUNTA.
Hope this gets you where you need to go.
Regards,