Forum Discussion
Response times
- 6 years ago
There is a difference between an empty string ("") and no data (null). The COALESCE function only works with the second scenario. If you know that for BP your demand data may be an empty string "" then you need to either adjust the first line, or replace the empty string with BLANK() (which produces a null value)
Merci mais à quoi fait référence "Date" ?
- lbendlin6 years ago
Super User
Youe ADDCOLUMNS line references CompteRendu, but it should reference the previously created table variable db.
- Aurélien6 years agoFrequent Visitor
Voici ce que j'ai :
Le probléme c'est que parfois la date de la demande peut être inférieur à la date d'intervention et dans ce cas la valeur doit être 0.
Merci pour l'aide
- lbendlin6 years ago
Super User
That's something you want to control in your data before you call the CALENDAR function. You can use the DATEDIFF function to find out if you have that issue, for example.
Here is a more compact version that checks for the date issue.
Difference = var d = DATEDIFF(CompteRendu[Date et Heure Demande],CompteRendu[Date et Heure Début],MINUTE) return if(d<0,0,d-1440*sumx(CALENDAR(CompteRendu[Date et Heure Demande],CompteRendu[Date et Heure Début]),if(WEEKDAY([Date],2)>5,1,0)))