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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
danny_tym
Frequent Visitor

Countifs to filter if date = today()

Hi guys,

 

     Need your help with a newbie coming across from Excel.

 

     I need DAX to count if the entries were based on today.

danny_tym_2-1633409929564.png

 

     I've tried using Calculate along with Filter as I understand that's the alternative to Countifs so my DAX function were as follows:

 

danny_tym_3-1633409981485.png

 

    Would appreciate any help where I've gone wrong.

 

    I like to also create new measures based on the hour, for example, 8am - 9am, etc.

 

    Thanks in advance!

 

Cheers,

DT

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@danny_tym , Create a date without timestamp

 

example

Date = [datetime].date
or
Date = date(year([datetime]),month([datetime]),day([datetime]))

 

Then it can work with today

 

or change filter like

filter(log, log[datetimeconerter] >=Today && log[datetimeconerter]  <today() +1 )

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

2 REPLIES 2
amitchandak
Super User
Super User

@danny_tym , Create a date without timestamp

 

example

Date = [datetime].date
or
Date = date(year([datetime]),month([datetime]),day([datetime]))

 

Then it can work with today

 

or change filter like

filter(log, log[datetimeconerter] >=Today && log[datetimeconerter]  <today() +1 )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for the prompt response.

 

I added the extra column 'Date' through Power Query. 

 

Edit the formula and it turn up with this error:

 

danny_tym_0-1633412959881.png

Any help would be appreciated.

 

Thanks,

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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