Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
IvanS
Helper V
Helper V

Time visualizaiton (occupancy vs. availability)

Hello guys,

 

I have large datasets of charging of electric vehicles. Selected columns as per below:

 

- Location ID

- Connector ID (one Location can have multiple connectors)

- Charging from (date time)

- Charging to (date time)

 

What I want to achieve is to create visual that will show time utilization based on 15 minutes intervals (bins). It can be either tabular view (below) or graphical in form of project management's Gantt chart.

Example: if I have charging session that will start on 12.2.2025 at 18:02 and finish on 12.2.2025 at 19:14, I need to show it as per below:

 

 12.2.12.2.12.2.12.2.12.2.12.2.12.2.12.2.12.2.
Location ID17:3017:4518:0018:1518:3018:4519:0019:1519:30
ABC-01(blank) or green (blank) or greenX or redX or redX or redX or redX or red (blank) or green (blank) or green
ABC-02         
...         

 

Please note that charging session can last also overnight - e.g. starting from 12.2. 23:30 until 13.2. 1:15. This must be reflected in the visual.

Also there can be multiple charging sessions on one location at given time (due to multiple connectors).

 

What is the best way to achieve this result?

 

Thank you for any help!

Ivanuska

 

 

1 ACCEPTED SOLUTION
FarhanJeelani
Super User
Super User

Dear @IvanS ,

-- Create a table with 15-minute intervals

TimeIntervals =
ADDCOLUMNS(
GENERATE(
CALENDAR(DATE(2025,1,1), DATE(2025,12,31)),
SELECTCOLUMNS(
GENERATESERIES(TIME(0,0,0), TIME(23,45,0), TIME(0,15,0)),
"Time", [Value]
)
),
"DateTime", [Date] + [Time]
)

 

-- Create a measure to check if charging session is active during each 15-minute interval

ChargingStatus =
VAR CurrentInterval = SELECTEDVALUE('TimeIntervals'[DateTime])
RETURN
IF(
CALCULATE(
COUNTROWS('ChargingData'),
FILTER(
'ChargingData',
'ChargingData'[Charging from] <= CurrentInterval && 'ChargingData'[Charging to] > CurrentInterval
)
) > 0,
"X", -- or use a color indicator like "Red"
BLANK() -- or use a color indicator like "Green"
)

 

-- Use a Matrix visual with Location ID as rows, Time Intervals as columns, and ChargingStatus as values.
-- Alternatively, create a Gantt-like visual using a custom visual from the Power BI marketplace, linking the ChargingStart and ChargingEnd times to the Gantt chart start and end dates.

 

Please mark this as solution if it helps you. Appreciate Kudos.

View solution in original post

2 REPLIES 2
FarhanJeelani
Super User
Super User

Dear @IvanS ,

-- Create a table with 15-minute intervals

TimeIntervals =
ADDCOLUMNS(
GENERATE(
CALENDAR(DATE(2025,1,1), DATE(2025,12,31)),
SELECTCOLUMNS(
GENERATESERIES(TIME(0,0,0), TIME(23,45,0), TIME(0,15,0)),
"Time", [Value]
)
),
"DateTime", [Date] + [Time]
)

 

-- Create a measure to check if charging session is active during each 15-minute interval

ChargingStatus =
VAR CurrentInterval = SELECTEDVALUE('TimeIntervals'[DateTime])
RETURN
IF(
CALCULATE(
COUNTROWS('ChargingData'),
FILTER(
'ChargingData',
'ChargingData'[Charging from] <= CurrentInterval && 'ChargingData'[Charging to] > CurrentInterval
)
) > 0,
"X", -- or use a color indicator like "Red"
BLANK() -- or use a color indicator like "Green"
)

 

-- Use a Matrix visual with Location ID as rows, Time Intervals as columns, and ChargingStatus as values.
-- Alternatively, create a Gantt-like visual using a custom visual from the Power BI marketplace, linking the ChargingStart and ChargingEnd times to the Gantt chart start and end dates.

 

Please mark this as solution if it helps you. Appreciate Kudos.

Thank you @FarhanJeelani , it is working but the function has performance issues with large dataset. 

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

Top Solution Authors