Forum Discussion
Anonymous
7 years agoNot applicable
Convert DAX to M (speed)
Hello everybody,
I am trying to create a column which displays a boolean value based on the previous incident on the same object. If the created on date (of the incident) is within 30 days compared to the created on date of the previous incident, the value true must be showed. Based on this, we can conclude that the first fix was not good enough.
I tied this by using DAX, and the formula below works good. However, with many rows (80.000), this takes a long time to calculate and I even end up in memory issues (warnings). Is there a better way to produce this value, for example by using M. I am not very skilled in M so if somebody would help me, this would be much appreciated.
RepeatingVisit =
VAR PreviousVisit= CALCULATE(
MAX('(CRM) Incident'[created on]);
FILTER('(CRM) Incident';'(CRM) Incident'[created on] < EARLIER('(CRM) Incident'[created on]));
FILTER('(CRM) Incident';'(CRM) Incident'[objectid] = EARLIER('(CRM) Incident'[objectid]))
)
RETURN(
IF(PreviousVisit&& IF(PreviousVisit;
COUNTROWS(DATESBETWEEN(Datum[Date];PreviousVisit;'(CRM) Incident'[created on]))) < 30;true;false)
)
Example:
Created On ObjectId RepeatedVisit (expected output)
| 8-09-2018 | 1234 | false |
| 15-09-2018 | 432 | false |
| 21-09-2018 | 1234 | true (within 30 days, same object) |
| 1-12-2018 | 432 | false (same object, but not within 30 days) |
2 Replies
- AnonymousNot applicable
Hi Anonymous
Please post or share some data and the output expected to build a solution.
Cheers
CheenuSing
- AnonymousNot applicable
Hi Anonymous
Thank you for your response. I updated the message and included an example of the data and expected output. I would love to hear from you how you would fix this.