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.
Hello,
i have this data in source (Odpoledne = Afternoon, Dopoledne=morning,Konec=end)
and i need calculate total run time per day (based RecordDate)
Something like this (Morning/End-Morning/Start) + (Afternoon/End - Afternoon/Start)
Is it possible?
Thanks a lot
Jakub
Solved! Go to Solution.
Hi @Flashback87
Change the data type of 'StatisticValueText'column to time, then create a calculated column.
TotalMintes =
VAR _filter =
FILTER (
'Table',
[IDOfRecord] = EARLIER ( 'Table'[IDOfRecord] )
&& [InstrumentCode] = EARLIER ( 'Table'[InstrumentCode] )
&& [RecordDate] = EARLIER ( 'Table'[RecordDate] )
)
VAR _morning =
FILTER ( _filter, [StatisticGroupName] = "Dopoledne" )
VAR _after =
FILTER ( _filter, [StatisticGroupName] = "Odpoledne" )
RETURN
DATEDIFF (
CONVERT (
[RecordDate] & " "
& MINX ( _morning, [StatisticValueText] ),
DATETIME
),
CONVERT (
[RecordDate] & " "
& MAXX ( _morning, [StatisticValueText] ),
DATETIME
),
MINUTE
)
+ DATEDIFF (
CONVERT ( [RecordDate] & " " & MINX ( _after, [StatisticValueText] ), DATETIME ),
CONVERT ( [RecordDate] & " " & MAXX ( _after, [StatisticValueText] ), DATETIME ),
MINUTE
)
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Flashback87
Change the data type of 'StatisticValueText'column to time, then create a calculated column.
TotalMintes =
VAR _filter =
FILTER (
'Table',
[IDOfRecord] = EARLIER ( 'Table'[IDOfRecord] )
&& [InstrumentCode] = EARLIER ( 'Table'[InstrumentCode] )
&& [RecordDate] = EARLIER ( 'Table'[RecordDate] )
)
VAR _morning =
FILTER ( _filter, [StatisticGroupName] = "Dopoledne" )
VAR _after =
FILTER ( _filter, [StatisticGroupName] = "Odpoledne" )
RETURN
DATEDIFF (
CONVERT (
[RecordDate] & " "
& MINX ( _morning, [StatisticValueText] ),
DATETIME
),
CONVERT (
[RecordDate] & " "
& MAXX ( _morning, [StatisticValueText] ),
DATETIME
),
MINUTE
)
+ DATEDIFF (
CONVERT ( [RecordDate] & " " & MINX ( _after, [StatisticValueText] ), DATETIME ),
CONVERT ( [RecordDate] & " " & MAXX ( _after, [StatisticValueText] ), DATETIME ),
MINUTE
)
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
98 | |
97 | |
81 | |
77 | |
66 |
User | Count |
---|---|
126 | |
105 | |
103 | |
81 | |
72 |