Forum Discussion
Countrows from the same data between time intervals
- 1 year ago
Hi metalfortune, give this a try, and if you encounter any issues, let me know.
Create a calculated column:
TimeBucket = INT(HOUR([Time])/2) + INT(MINUTE([Time])/120) + DATEVALUE([Time])Then, create a measure:
MaxBusyVehicles = CALCULATE( MAXX( SUMMARIZE( data, [TimeBucket], "VehicleCount", COUNTROWS(data) ), [VehicleCount] ) )Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier! - 1 year ago
somehow bumped with what I wanted (I believe cant understand my own solution at all).
Here is the solution to the groupby but something weird is making my max here 26 instead of 25, i believe has to be with rounding 1/12 (the 2 hours) spoiling the the > and turning similar to >=,
then I have my full solution:Occupation = MAXX(ADDCOLUMNS( GROUPBY(data,[Time]),"Busy",COUNTROWS(FILTER(data,data[Time]<=EARLIER([Time]) && data[Time]>EARLIER([Time])-1/12))),[Busy])
Compared to yours, individual times look the same but final numbers perform different:Anyway, thanks for being my supplier ahadkarimi, take care.
Hi metalfortune, give this a try, and if you encounter any issues, let me know.
Create a calculated column:
TimeBucket = INT(HOUR([Time])/2) + INT(MINUTE([Time])/120) + DATEVALUE([Time])Then, create a measure:
MaxBusyVehicles =
CALCULATE(
MAXX(
SUMMARIZE(
data,
[TimeBucket],
"VehicleCount", COUNTROWS(data)
),
[VehicleCount]
)
)Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!
somehow bumped with what I wanted (I believe cant understand my own solution at all).
Here is the solution to the groupby but something weird is making my max here 26 instead of 25, i believe has to be with rounding 1/12 (the 2 hours) spoiling the the > and turning similar to >=,
then I have my full solution:
Compared to yours, individual times look the same but final numbers perform different: