Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have a data set with where items have multiple ship dates, I need to calculate the number of weeks between the last shipped date (most recent date) and today. I have tried datediff, creating custom measures, but I cannot seem to get it. Any help would be appreciated.
Solved! Go to Solution.
Looks like "lastDate" is a reserved name. We just need to change the variable name to something else. Try this:
Shipped Days Ago = var itemNumber = SELECTEDVALUE('YourTable'[ITEM_NUMBER])
var lastDateVal = CALCULATE(
MAX('YourTable'[SHIPPED_DATE]),
ALL('YourTable'),
'YourTable'[ITEM_NUMBER] = itemNumber
)
RETURN
DATEDIFF(Today(), lastDateVal, DAY)
Russ,
This is perfect! Thanks!
Give this a try. I didn't know your table's name, so i just called it "YourTable"
Shipped Days Ago = var itemNumber = SELECTEDVALUE('YourTable'[ITEM_NUMBER])
var lastDate = CALCULATE(
MAX('YourTable'[SHIPPED_DATE]),
ALL('YourTable'),
'YourTable'[ITEM_NUMBER] = itemNumber
)
RETURN
DATEDIFF(Today(), lastDate, DAY)
Hey Ross,
I got this error:
Looks like "lastDate" is a reserved name. We just need to change the variable name to something else. Try this:
Shipped Days Ago = var itemNumber = SELECTEDVALUE('YourTable'[ITEM_NUMBER])
var lastDateVal = CALCULATE(
MAX('YourTable'[SHIPPED_DATE]),
ALL('YourTable'),
'YourTable'[ITEM_NUMBER] = itemNumber
)
RETURN
DATEDIFF(Today(), lastDateVal, DAY)
User | Count |
---|---|
91 | |
85 | |
65 | |
62 | |
58 |
User | Count |
---|---|
150 | |
113 | |
95 | |
80 | |
72 |