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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Custom column - Count of entries with a given filter per day

Hello,

 

I'm using Power BI to manage Timesheet reports.

I need to create a custom column which counts the number of entries per day for a given client. Once I have that number, I need to substract a total of 45min per day spread over all entries of that client.

 

Here is some sample data:

 

dateclienthours
06.10.2019A1
06.10.2019A2
06.10.2019B1.5
06.10.2019A3
06.10.2019C0.5
07.10.2019A4
07.10.2019A1
07.10.2019C3
08.10.2019A3
08.10.2019D1
08.10.2019A2
08.10.2019B0.5
08.10.2019A1.5

 

What I'm looking to get is this (using Client A for the count) :

 

dateclienthours count_per_dayhours v2
06.10.2019A1 30.75
06.10.2019A2 31.75
06.10.2019B1.5 31.5
06.10.2019A3 32.75
06.10.2019C0.5 30.5
07.10.2019A4 23.625
07.10.2019A1 20.625
07.10.2019C3 23
08.10.2019A3 32.75
08.10.2019D1 31
08.10.2019A2 31.75
08.10.2019B0.5 30.5
08.10.2019A1.5 31.25

 

The hours v2 is simple to get once I get the Count/day :

IF(Client = "A" THEN hoursv2 = hours-0.75/count_per_day ELSE hours)

 

How can I achieve this count as a new column ?

 

Thanks !

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

As  a calc column you can use

 

Column =
CALCULATE (
    COUNTROWS ( TableName ),
    ALLEXCEPT ( TableName, TableName[Dates] ),
    TableName[client] = "A"
)

View solution in original post

@Anonymous 

 

As a custom Column in Power Query

 

=Table.RowCount(
Table.SelectRows(
    #"Changed Type",
     (x)=> x[date]=[date] and x[client]="A"
                )
               )

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

As  a calc column you can use

 

Column =
CALCULATE (
    COUNTROWS ( TableName ),
    ALLEXCEPT ( TableName, TableName[Dates] ),
    TableName[client] = "A"
)

@Anonymous 

 

As a custom Column in Power Query

 

=Table.RowCount(
Table.SelectRows(
    #"Changed Type",
     (x)=> x[date]=[date] and x[client]="A"
                )
               )

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors