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
Anonymous
Not applicable

Nedd help with measure (Last 24 hours count)

Hello,

 

I want to make a measurement that allows me to count the names of tasks like indicating on the red column using the second blue column named DateTime as a filter, indeed the data I want to visualize are the data of the last 24 hours. thank you for your help.  So, as is shown in the picture the result will be 4.

 

Capture99.PNG

 

My best regards. Thank you. 

1 REPLY 1
Anonymous
Not applicable


@Anonymous wrote:

Hello,

 

I want to make a measurement that allows me to count the names of tasks like indicating on the red column using the second blue column named DateTime as a filter, indeed the data I want to visualize are the data of the last 24 hours. thank you for your help.  So, as is shown in the picture the result will be 4.

 

Capture99.PNG


The table structure you should probably have is this:

Task Name | Task Date | Task Time | Task Datetime (if you need this column)

 

Once you have these, you can define a measure:

[# Tasks] := DISTINCTCOUNT( Tasks[Task Name] )

When you create a pivot table and put [Task Date] on rows/columns, the measure will count the distinct names of the tasks that have this date in common.

 

Another possibility is that you just drag the Tasks[Datetime] column into a canvass and want to count the number of Tasks[Task Name] that have their Datetime within 24 hours (back in time) of the currently visible Datetime. In such a case you'd have to create a different measure:

 

[# Tasks Within 24 Hrs] :=
var __currentDatetime = SELECTEDVALUE( Tasks[Datetime] )
var __currentDatetimeMinus24Hrs = __currentDateTime - 1 -- returns the previous day at the same time
var __measure =
	 CALCULATE(
	 	[# Tasks],
	 	Tasks[Datetime] <= __currentDatetime,
	 	Tasks[Datetime] > __currentDatetimeMinus24Hrs
	 )
return
	__measure

Best

Darek

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.