Forum Discussion
bdeleur
Helper III
3 years agoDischarge department
Hi, I want to make a report witch contains the following information. Out of a big data file I want to extract the follow up department. So I have department A and how many have a transfer (dis...
- 3 years ago
bdeleur
For now this is what I can provide you. The difference between Count 2 and Count 3 is that count 3 shall not count discharged from same department unless there is a discharge date. The difference shall not be noticed using the sample data as there are no blanks in the end date.
tamerj1
Community Champion
3 years agoHi bdeleur
Please refer to attached sample file with the proposed solution
Count =
SUMX (
VALUES ( 'Table'[Reference] ),
VAR CurrentTable = CALCULATETABLE ( 'Table' )
VAR FirstRecord = TOPN ( 1, CurrentTable, 'Table'[Start date], ASC )
VAR LastRecord = TOPN ( 1, CurrentTable, 'Table'[Start date] )
VAR FirstDepartment = MAXX ( FirstRecord, 'Table'[Department] )
VAR LastDepartment = MAXX ( LastRecord, 'Table'[Department] )
RETURN
IF (
FirstDepartment <> LastDepartment
&& MAX ( 'To'[Department] ) = LastDepartment
&& MAX ( 'FROM'[Department] ) = FirstDepartment,
1
)