Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Ok so bare with me this is going to get a little confusing;
I want to get the values in the desired column like the table below:
The calculation is: [StartTime] minus the previous row [Endtime]. So row 2 [Starttime] minus row 1 [Endtime] would be 17:04:48 minus 17:04:31 (=17sec). However I want to exclude rows where CustAgentFl = 0 AND Transferflag = 0 before doing the date subtract calculation. Also, if Starttime- Endtime is <0 then just 0.
The rows are all grouped by the same NID, so of course the DAX or M query will need to group by the NID.
Any help would be great.Thanks
Solved! Go to Solution.
Hi @rax99,
For your requirement, you could create a calculated column with the formula below. Please note, you need to create the index column in Query Editor firstly.
Column = VAR a = CALCULATE ( MAX ( 'Table1'[EndTime] ), FILTER ( ALLEXCEPT('Table1',Table1[NID]), 'Table1'[Index] <= EARLIER ( 'Table1'[Index] ) - 1 ) ) RETURN IF ( 'Table1'[CustAgentFI] = 0 && 'Table1'[TransferFIag] = 0, TIME ( HOUR ( 0 ), MINUTE ( 0 ), SECOND ( 0 ) ), IF ( ISBLANK ( a ), TIME ( HOUR ( 0 ), MINUTE ( 0 ), SECOND ( 0 ) ), IF ( 'Table1'[StartTime] - a < 0, TIME ( HOUR ( 0 ), MINUTE ( 0 ), SECOND ( 0 ) ), 'Table1'[StartTime] - a ) ) )
Here is my test result.
More details, you could refer to the attachment.
Best Regards,
Cherry
Hi @rax99,
For your requirement, you could create a calculated column with the formula below. Please note, you need to create the index column in Query Editor firstly.
Column = VAR a = CALCULATE ( MAX ( 'Table1'[EndTime] ), FILTER ( ALLEXCEPT('Table1',Table1[NID]), 'Table1'[Index] <= EARLIER ( 'Table1'[Index] ) - 1 ) ) RETURN IF ( 'Table1'[CustAgentFI] = 0 && 'Table1'[TransferFIag] = 0, TIME ( HOUR ( 0 ), MINUTE ( 0 ), SECOND ( 0 ) ), IF ( ISBLANK ( a ), TIME ( HOUR ( 0 ), MINUTE ( 0 ), SECOND ( 0 ) ), IF ( 'Table1'[StartTime] - a < 0, TIME ( HOUR ( 0 ), MINUTE ( 0 ), SECOND ( 0 ) ), 'Table1'[StartTime] - a ) ) )
Here is my test result.
More details, you could refer to the attachment.
Best Regards,
Cherry
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |