I have the following problem ..
I have the following table:
Iwanttocreateacalculatedcolumnthattellsmethedifferenceofdaysbetweentwodatesofthesamecode(COD),thedifferenceshouldbecalculatedbasedonthedatebeforetheline.Forexample:
UsingCODB
COD|DATE|DaysofDifference
B|05/01/2018|
B|09/01/2018|4
B|12/01/2018|3
Intheexampleimagethecodes/datesaresortedinsequence,butinrealitytheyareoutoforder.
ItriedtousethefollowingsentenceinDAX:
DATEDIFF(Testing[DATE];FIRSTDATE(FILTER(ALL(Testing[DATE]);Testing[DATE]>EARLIER(Testing[DATE])));DAY)
ExplainingwhatI'vetried: MakethedifferencebetweenthedateonthelineandusingtheEARLIERfunctiontogetthemostrecentdateoutofthecurrentone.
However,Igotthefollowingresult:
I'm not able to filter COD , so that the analysis of 'EARLIER' is performed only in the same 'group', so I understand PowerBI is considering all dates. >
Any ideas?