Forum Discussion
CALCULATE TIME INTERVAL WITH CONDITIONS
- 4 years ago
Hi,
According to your description, I can roughly understand your requirement, I created some test data to achieve your requirements, you can try my steps:
This is the test data I created based on your data model:
I created three measures like this:
Total Time = var _start=CALCULATE(MAX('Table'[Time]),FILTER(ALL('Table'),[DocNo]=MAX('Table'[DocNo])&&[Line]=MAX('Table'[Line])&&[SLine]=MAX('Table'[SLine])&&[Status]="Start")) var _end=CALCULATE(MAX('Table'[Time]),FILTER(ALL('Table'),[DocNo]=MAX('Table'[DocNo])&&[Line]=MAX('Table'[Line])&&[SLine]=MAX('Table'[SLine])&&[Status]="End")) return DATEDIFF(_start,_end,MINUTE)Breaktime = SUM('Table'[Break Time])Process Time = [Total Time]-[Breaktime]Then I create a table chart and place it like this:
And you can get what you want.
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
According to your description, I can roughly understand your requirement, I created some test data to achieve your requirements, you can try my steps:
This is the test data I created based on your data model:
I created three measures like this:
Total Time =
var _start=CALCULATE(MAX('Table'[Time]),FILTER(ALL('Table'),[DocNo]=MAX('Table'[DocNo])&&[Line]=MAX('Table'[Line])&&[SLine]=MAX('Table'[SLine])&&[Status]="Start"))
var _end=CALCULATE(MAX('Table'[Time]),FILTER(ALL('Table'),[DocNo]=MAX('Table'[DocNo])&&[Line]=MAX('Table'[Line])&&[SLine]=MAX('Table'[SLine])&&[Status]="End"))
return
DATEDIFF(_start,_end,MINUTE)Breaktime = SUM('Table'[Break Time])Process Time = [Total Time]-[Breaktime]
Then I create a table chart and place it like this:
And you can get what you want.
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.