Forum Discussion
Minus Breaktime Between Start and End Time
- 4 years ago
Hi, KUMAR_AK
I used other logic to implement it before, so it will be relatively simple
If it must be this logic, Dax is not easy to express. Sometimes the logic of the language is converted into dax, which is not as simple as it seems, it is very complicated.
I hope you provide the sample won't change...😅
Try:
Measure = IF ( HASONEVALUE ( 'Table'[starttime] ), SUMX ( ADDCOLUMNS ( SUMMARIZE ( FILTER ( ALL ( 'Table' ), [name] = "Open" ), [starttime], "enddate", MINX ( FILTER ( ALL ( 'Table' ), [name] = "Close" && [starttime] > EARLIER ( 'Table'[starttime] ) ), [starttime] ) ), "breaktime", SUMX ( FILTER ( ALL ( 'Table' ), [starttime] > EARLIER ( 'Table'[starttime] ) && [starttime] < EARLIER ( [enddate] ) && [breakdetails] = "Breaktime" && [starttime] = SELECTEDVALUE ( 'Table'[starttime] ) ), DATEDIFF ( [starttime], [_Endtime], MINUTE ) ) ), [breaktime] ), SUMX ( ADDCOLUMNS ( SUMMARIZE ( FILTER ( ALL ( 'Table' ), [name] = "Open" ), [starttime], "enddate", MINX ( FILTER ( ALL ( 'Table' ), [name] = "Close" && [starttime] > EARLIER ( 'Table'[starttime] ) ), [starttime] ) ), "breaktime", SUMX ( FILTER ( ALL ( 'Table' ), [starttime] > EARLIER ( 'Table'[starttime] ) && [starttime] < EARLIER ( [enddate] ) && [breakdetails] = "Breaktime" ), DATEDIFF ( [starttime], [_Endtime], MINUTE ) ) ), [breaktime] ) )Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,
Community Support Team _ Janey
Hi, KUMAR_AK
I used other logic to implement it before, so it will be relatively simple
If it must be this logic, Dax is not easy to express. Sometimes the logic of the language is converted into dax, which is not as simple as it seems, it is very complicated.
I hope you provide the sample won't change...😅
Try:
Measure =
IF (
HASONEVALUE ( 'Table'[starttime] ),
SUMX (
ADDCOLUMNS (
SUMMARIZE (
FILTER ( ALL ( 'Table' ), [name] = "Open" ),
[starttime],
"enddate",
MINX (
FILTER (
ALL ( 'Table' ),
[name] = "Close"
&& [starttime] > EARLIER ( 'Table'[starttime] )
),
[starttime]
)
),
"breaktime",
SUMX (
FILTER (
ALL ( 'Table' ),
[starttime] > EARLIER ( 'Table'[starttime] )
&& [starttime] < EARLIER ( [enddate] )
&& [breakdetails] = "Breaktime"
&& [starttime] = SELECTEDVALUE ( 'Table'[starttime] )
),
DATEDIFF ( [starttime], [_Endtime], MINUTE )
)
),
[breaktime]
),
SUMX (
ADDCOLUMNS (
SUMMARIZE (
FILTER ( ALL ( 'Table' ), [name] = "Open" ),
[starttime],
"enddate",
MINX (
FILTER (
ALL ( 'Table' ),
[name] = "Close"
&& [starttime] > EARLIER ( 'Table'[starttime] )
),
[starttime]
)
),
"breaktime",
SUMX (
FILTER (
ALL ( 'Table' ),
[starttime] > EARLIER ( 'Table'[starttime] )
&& [starttime] < EARLIER ( [enddate] )
&& [breakdetails] = "Breaktime"
),
DATEDIFF ( [starttime], [_Endtime], MINUTE )
)
),
[breaktime]
)
)
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,
Community Support Team _ Janey
Hi v-janeyg-msft
I this that should work ,also
Can you please share the Pbix file ?
Thanks
Kumar
- v-janeyg-msft4 years ago
Community Support
Hi, KUMAR_AK
I just simply used the enter data to copy your sample data and create the measure, not do other operations.