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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Terrassa
Helper I
Helper I

Convert a row into a column

Hello,

Our payroll application can export the working time per day of all employees in this format:

DateStart timeEnd time
John Smith  
01/01/2023  8:0017:03
01/02/2023  8:0217:10
01/03/2023  7:5916:45
01/04/2023  8:1017:00
01/05/2023  7:5517:05
Jane Doe  
01/01/2023  8:0316:55
01/02/2023  8:0117:03
01/03/2023  7:5517:10
01/04/2023  7:5516:57
01/05/2023  8:0018:30

 

I need to do a report calculating the total worked time per employee per month, but to do this I need to add a new column with the employee name in all the rows. How can I get the employee name that is now in the same column than the dates and put it into a new column?

 

Thank you very much in advance

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi

 

let
Source = Your_Source,
Name = Table.AddColumn(Source, "Name", each if [Start time] = null then [Date] else null),
FillDown = Table.FillDown(Name,{"Name"}),
Filter = Table.SelectRows(FillDown, each [Start time] <> null)
in
Filter

Stéphane 

View solution in original post

2 REPLIES 2
slorin
Super User
Super User

Another solution

= Table.Group(
Source,
{"Date"},
{{"Data", each Table.Skip(_)}},
GroupKind.Local,
(x,y) => Number.From(y[Date] is text)
)

group, if row[date] is type text then new group, else same group

then expand

 

Stéphane

slorin
Super User
Super User

Hi

 

let
Source = Your_Source,
Name = Table.AddColumn(Source, "Name", each if [Start time] = null then [Date] else null),
FillDown = Table.FillDown(Name,{"Name"}),
Filter = Table.SelectRows(FillDown, each [Start time] <> null)
in
Filter

Stéphane 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.