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
pardeepd84
Helper III
Helper III

Calculated column not counting time properly

Hi,

 

I have created a calculated column which counts the ID, start date and start time which includes time from midnight to midnight. If is the same it will count the number of times it appears in the dataset, if any are blank it returns 0. However I have noticed that if the time is 00:00 it seems to be returning 0 rather than 1, 2, 3 etc even though the ID, start date and start time all have data in the cells.

 

Please could you advise how to resolve this. 

 

The formula I have written is:

Results3 =
VAR _currentrowID = 'Table (2)'[ID]
VAR _CRstartDate = 'Table (2)'[Start Date]
VAR _CRstartTime = 'Table (2)'[Start Time]
RETURN
    COUNTROWS (
        FILTER (
            'Table (2)',
            'Table (2)'[ID] = _currentrowID
                && _CRstartDate = 'Table (2)'[Start Date]
                && _CRstartTime = 'Table (2)'[Start Time]
                && 'Table (2)'[ID] <> BLANK ()
                && 'Table (2)'[Start Date] <> BLANK ()
                && 'Table (2)'[Start Time] <> BLANK ()
                && 'Table (2)'[ID] = _currentrowID
                && 'Table (2)'[Start Date] = _CRstartDate
                && 'Table (2)'[Start Time] = _CRstartTime
        )
    ) + 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@pardeepd84, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
pardeepd84
Helper III
Helper III

Please find attached sample data, I have exported the data into excel as there is a lot of sensitive/client identifiable information in my dataset in Power Bi.  

 

As mentioned above the formula is working for all other rows however if the time is recorded as 00:00 then it is not counting it, however it should be counting the number of times it appears in the dataset.  As the ID, start date and start time all have data entered in the cells it should either return 1 or if all three columns have the exact same data in it it should return a number dependent on how many times it appears in the dataset.  As you can see in the example below for ID 5432 has a start date and start time, as the data is the same and appears in the dataset twice it returns 2, however for ID 1234 it has a start date and start time so should return 1 or 2 if it appears in the dataset again. 

 

Midnight not counting.JPG

 

 

amitchandak
Super User
Super User

@pardeepd84, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Please see sample data attached to this topic. 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors