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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Faeez
Frequent Visitor

i am trying to fetch the count of data such as tickets created in last 24 hours in Power BI usingDAX

I set up a date column and added two options if todays date (today) then Yes if not should pop up rather its not oving

 

 

1 ACCEPTED SOLUTION

Hi @Faeez ,

 

To calculate the count of tickets created in the last 24 hours, you can use the following DAX measure:

Tickets_Last_24_Hours = 
CALCULATE(
    COUNTROWS('Table'),
    'Table'[Created] >= NOW() - 1
)

This measure counts the number of rows in the table where the Created datetime column is greater than or equal to 24 hours ago, as determined by the NOW() function. Replace 'Table' with the actual name of your table. Ensure the Created column is formatted as a datetime type for proper comparison. If you need a static calculation based on a specific reference datetime, replace NOW() with DATETIME(YYYY, MM, DD, HH, MM, SS).

 

Best regards,

View solution in original post

12 REPLIES 12
Faeez
Frequent Visitor

Faeez_0-1734008497189.png

 

moncx
Resolver II
Resolver II

Can you give more context to your problem? How your data looks like, what have you done and what does not work? Does the filter not work when you apply 'if today' option?

Faeez
Frequent Visitor

I am trying to build a report for a team where i am trying to fetch P1 incidents reported in last 24 hours.

 

can you assist with any troubleshooting step or query?

How does you data look like? Do you have only Date or dateTime? 

Faeez
Frequent Visitor

Faeez_0-1733928410953.png

 

If you see above these are the dates on which we got issues and here i am trying to implement a filter to get the count of tickets which we received in last 24 hours 

 

Anonymous
Not applicable

Hi, @Faeez 

Thanks for moncx's reply. You can try this dax to achieve your need.

vyaningymsft_0-1733971703960.png

 

Flag = IF( SELECTEDVALUE('Date'[Date]) >= (TODAY() -1) && SELECTEDVALUE('Date'[Date])<TODAY(),"Yes")

Counts = CALCULATE(COUNTROWS('Date'),FILTER('Date',[Flag] = "Yes"))

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

could you please help me with creating a DAX query for getting count of tickets created in last 24 hours using the data given below?

 

 

Incident NumberPriorityCreatedWork groupIssue description
INC-2000001-critical2024-12-12 00:28:00Network L2Network issue
INC-2000011-critical2024-12-12 00:28:00DB L2DB issue
INC-2000021-critical2024-12-12 00:28:00Network L2Network issue
INC-2000031-critical2024-12-12 00:28:00DB L2DB issue
INC-2000041-critical2024-12-10 00:28:00Network L2Network issue
INC-2000051-critical2024-12-11 00:28:00DB L2DB issue

Hi @Faeez ,

 

To calculate the count of tickets created in the last 24 hours, you can use the following DAX measure:

Tickets_Last_24_Hours = 
CALCULATE(
    COUNTROWS('Table'),
    'Table'[Created] >= NOW() - 1
)

This measure counts the number of rows in the table where the Created datetime column is greater than or equal to 24 hours ago, as determined by the NOW() function. Replace 'Table' with the actual name of your table. Ensure the Created column is formatted as a datetime type for proper comparison. If you need a static calculation based on a specific reference datetime, replace NOW() with DATETIME(YYYY, MM, DD, HH, MM, SS).

 

Best regards,

Could you also tell me how to get the count of last 72 hours using DAX and another requirement is how to get the data for those count of data from 24hours/72 hours?

 

 

@DataNinja777  Thank you Very much, this query help me achieve the output. 

you are awesome.

Anonymous
Not applicable

Hi, @Faeez 

Of course, but what do you expect to achieve, you can bring out the effect you want.

Best Regards,
Yang

Community Support Team

Hello @Anonymous 

i would like to achieve the count of tickets received in last 24 hours using the data i gave you.

 

I tried to run the DAX query you gave previously but i was getting error.

 

Could you try the DAX for the given data ?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.