Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
I have a table called "Productivity". In this table, I am attempting to calculate the number of days between "TRIAG" and "DIAGNOSIS", when the serial numbers match. Any ideas?
Solved! Go to Solution.
Hi @Anonymous
can you try this code:
days diff =
var _dia = 'Table data'[dated]
var _triag = CALCULATE( MIN('Table data'[dated]) , FILTER('Table data','Table data'[Serial.no] = EARLIER('Table data'[Serial.no])&& 'Table data'[wc-description] = "TRIAG"))
var _DIAG = CALCULATE( _dia , FILTER('Table data','Table data'[Serial.no] = EARLIER('Table data'[Serial.no])&& 'Table data'[wc-description] = "DIAGNOSIS"))
return
DATEDIFF(_triag,_DIAG,DAY)
Hi @Anonymous
can you please try the calculated column:
days diff =
var _st = 'Table data'[start_date]
var _traig = CALCULATE( _st , FILTER('Table data','Table data'[Serial.no] = EARLIER('Table data'[Serial.no])&& 'Table data'[wc-description] = "TRIAG"))
var _DIAG = CALCULATE( _st , FILTER('Table data','Table data'[Serial.no] = EARLIER('Table data'[Serial.no])&& 'Table data'[wc-description] = "DIAGNOSIS"))
return
DATEDIFF(_traig,_DIAG,DAY)
Thanks,
AnthonyJoseph
I modified the formula slightly to the parameters suggested, but it did not work. In the attached example, it is showing the days elapsed having been 0, when a day has passed between the two actions.
Hi @Anonymous
can you try this code:
days diff =
var _dia = 'Table data'[dated]
var _triag = CALCULATE( MIN('Table data'[dated]) , FILTER('Table data','Table data'[Serial.no] = EARLIER('Table data'[Serial.no])&& 'Table data'[wc-description] = "TRIAG"))
var _DIAG = CALCULATE( _dia , FILTER('Table data','Table data'[Serial.no] = EARLIER('Table data'[Serial.no])&& 'Table data'[wc-description] = "DIAGNOSIS"))
return
DATEDIFF(_triag,_DIAG,DAY)
Hi @Anonymous screenshot below:
if this output is incorrect, can you share the expected output in table format so me to help better...
Thanks,
AnthonyJoseph
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |