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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
mtrotter
Regular Visitor

Count rows on or before a specific row in terms of time

Hello people,

 

I need to create a new table from a table called DASHBOARD PANEL:
Imported Column 1: "id" of service

Imported Column 2: "F.Pres" Presentation Date of service

Imported Column 3: "H.Pres" Presentation Time of service

Calculated Column 4: Services between 8:00 AM and the presentation time of the row on the same presentation date

 

For example, for day 12/07/2022:

 

idF.PresH.PresServices Between 8 AM and H.Pres
48625512/07/20228:00:006
48105812/07/20228:00:006
48406812/07/20228:00:006
48090812/07/20228:00:006
47681112/07/20228:00:006
48403412/07/20228:00:006
47680812/07/20228:00:006
48524712/07/20228:30:0011
48524812/07/20228:30:0011
48635612/07/20228:30:0011
48455312/07/20228:30:0011
48461112/07/20228:30:0011
47848112/07/20228:30:0011
48407012/07/20229:00:0014
48460912/07/20229:00:0014
48407112/07/202210:00:0017
48651512/07/202210:00:0017
48403212/07/202210:00:0017
48625712/07/202211:00:0022
48105712/07/202211:00:0022
48407912/07/202211:00:0022
48460612/07/202211:00:0022
48390012/07/202211:00:0022
48407212/07/202212:00:0027
48403312/07/202212:00:0027
47681412/07/202212:00:0027
48089612/07/202212:00:0027
47682012/07/202212:00:0027
48572512/07/202213:00:0028
48626112/07/202214:00:0029
48390112/07/202222:00:0030
48214712/07/202223:00:0031
48481312/07/202223:59:0032

 

Does anybody know how to do this?

1 ACCEPTED SOLUTION
mtrotter
Regular Visitor

I ended up making a column instead of a table, this worked:

Services between 8:00 and presentation  =
=
VAR Fecha_Fila_Actual = 'DASHBOARD PANEL'[F.Pres]
VAR Hora_Presentacion = 'DASHBOARD PANEL'[H.Pres]
RETURN
CALCULATE(DISTINCTCOUNT('DASHBOARD PANEL'[id]),
    ALLEXCEPT('DASHBOARD PANEL','DASHBOARD PANEL'[F.Pres]),
    'DASHBOARD PANEL'[F.Pres] = Fecha_Fila_Actual,
    'DASHBOARD PANEL'[Tipo SS] = "LOCAL SCL",
     DASHBOARD[Estado] = "FINALIZADO",
    'DASHBOARD PANEL'[H.Pres] <= Hora_Presentacion,
    'DASHBOARD PANEL'[H.Pres] >= TIME(8,0,0)
)-1

View solution in original post

1 REPLY 1
mtrotter
Regular Visitor

I ended up making a column instead of a table, this worked:

Services between 8:00 and presentation  =
=
VAR Fecha_Fila_Actual = 'DASHBOARD PANEL'[F.Pres]
VAR Hora_Presentacion = 'DASHBOARD PANEL'[H.Pres]
RETURN
CALCULATE(DISTINCTCOUNT('DASHBOARD PANEL'[id]),
    ALLEXCEPT('DASHBOARD PANEL','DASHBOARD PANEL'[F.Pres]),
    'DASHBOARD PANEL'[F.Pres] = Fecha_Fila_Actual,
    'DASHBOARD PANEL'[Tipo SS] = "LOCAL SCL",
     DASHBOARD[Estado] = "FINALIZADO",
    'DASHBOARD PANEL'[H.Pres] <= Hora_Presentacion,
    'DASHBOARD PANEL'[H.Pres] >= TIME(8,0,0)
)-1

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.