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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
moon_walker
Helper I
Helper I

Populating days of the week in a table

Hello

I have a table that shows the operating hours of systems by the days of the week. But not all the days of the week are listed, only a range. There are about 1000 distinct systems, with varying schedules.

 

System IDFromStart TimeToEnd Time
abcdMon7:30amFri11:59pm
abcdTue12:00amSat4:30am
abcdSat8:30amN/A11:59pm
abcdSun12:00amN/A3:00am
abcdSun8:00amN/A11:59pm
efghSun12:00amSat11:59pm
ijklMon8:00amFri8:00pm
ijklSat8:00amSun5:00am

 

And I would like to turn it into this. 7 days of the week for each system. If there are multiple time spans for a given day, then they will be in multiple columns, on the same row.

System IDDayStart Time 1End Time 1Start Time 2End Time 2Start Time 3End Time 3Duration Minutes
abcdMon7:30am11:59pmN/AN/AN/AN/A990
abcdTue12:00am4:30am7:30am11:59pmN/AN/A1260
abcdWed12:00am4:30am7:30am11:59pmN/AN/A1260
abcdThu12:00am4:30am7:30am11:59pmN/AN/A1260
abcdFri12:00am4:30am7:30am11:59pmN/AN/A1260
abcdSat8:30am11:59pmN/AN/AN/AN/A930
abcdSun12:00am3:00am8:00am11:59pmN/AN/A960
efghMon12:00am11:59pmN/AN/AN/AN/A1440
efghTue12:00am11:59pmN/AN/AN/AN/A1440
efghWed12:00am11:59pmN/AN/AN/AN/A1440
efghThu12:00am11:59pmN/AN/AN/AN/A1440
efghFri12:00am11:59pmN/AN/AN/AN/A1440
efghSat12:00am11:59pmN/AN/AN/AN/A1440
efghSun12:00am11:59pmN/AN/AN/AN/A1440
etc.etc.etc.etc.etc.etc.etc.etc.etc.

 

Any help is much appreciated.

Thank you

 

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @moon_walker ;

You could create a new table by dax ,then create a column.

Table 2 = GENERATE(VALUES('Table'[System ID]),{"Mon","Tue","Wed","Thu","Fri","Sat","Sun"})

create columns:

rank = SWITCH([From],"Mon",1,"Tue",2,"Wed",3,"Thu",4,"Fri",5,"Sat",6,"Sun",0)
start time = 
CALCULATE(MIN('Table'[Start Time]),FILTER('Table',[System ID]=EARLIER('Table 2'[System ID])&&[From]=EARLIER('Table 2'[From])))
sarttime2 = 
var _max=CALCULATE(MAX('Table 2'[rank]),FILTER(ALL('Table 2'),[rank]<=EARLIER('Table 2'[rank])&& [System ID]=EARLIER('Table 2'[System ID])&&[start time]<>BLANK()))
return CALCULATE(MAX('Table 2'[start time]),FILTER(ALL('Table 2'),[rank]=_max&&[System ID]=EARLIER('Table 2'[System ID])))
End time = CALCULATE(MAX('Table'[End Time]),FILTER('Table',[System ID]=EARLIER('Table 2'[System ID])))
end time2 = 
var _max=CALCULATE(MAX('Table 2'[rank]),FILTER(ALL('Table 2'),[rank]<=EARLIER('Table 2'[rank])&& [System ID]=EARLIER('Table 2'[System ID])&&[start time]<>BLANK()))
return CALCULATE(MAX('Table 2'[End time]),FILTER(ALL('Table 2'),[rank]=_max&&[System ID]=EARLIER('Table 2'[System ID])))

The final show:

vyalanwumsft_0-1659407871077.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-yalanwu-msft , thank you for this attempt.

In your solution, it gives system 'abcd' a start and end time as 12:00am-4:30am. But if we see my example, system 'abcd' is online from 12:00-4:30am as well as 7:30am-11:59pm. This is for Tuesday, Wednesday, Thursday, and Friday.

 

That's why the desired solution, the ranges are split up into multiple start and end columns.

Is there a way where both these time ranges can be shown in the final table?

From my example, see Tue-Fri

System IDDayStart Time 1End Time 1Start Time 2End Time 2Start Time 3End Time 3Duration Minutes
abcdMon7:30am11:59pmN/AN/AN/AN/A990
abcdTue12:00am4:30am7:30am11:59pmN/AN/A1260
abcdWed12:00am4:30am7:30am11:59pmN/AN/A1260
abcdThu12:00am4:30am7:30am11:59pmN/AN/A1260
abcdFri12:00am4:30am7:30am11:59pmN/AN/A1260
abcdSat8:30am11:59pmN/AN/AN/AN/A930
abcdSun12:00am3:00am8:00am11:59pmN/AN/A960

 

Thank you

Much appreciated

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.