Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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 ID | 17:30 | 17:45 | 18:00 | 18:15 | 18:30 | 18:45 | 19:00 | 19:15 | 19:30 |
ABC-01 | (blank) or green | (blank) or green | X or red | X or red | X or red | X or red | X 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
Solved! Go to Solution.
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.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
92 | |
75 | |
65 | |
49 | |
36 |
User | Count |
---|---|
114 | |
89 | |
80 | |
60 | |
40 |