Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have a dataset and need to create a new column that counts the occurrences from a separate column for the previous minute from most recent occurrence. What is the easiest way to do this?
This is an example:
Timestamp | Text String Column | New Column with Count |
6/28/2023 8:34:00 | Apple | 3 |
6/28/2023 8:33:59 | Cherry | 2 |
6/28/2023 8:33:55 | Apple | 2 |
6/28/2023 8:33:35 | Apple | 1 |
6/28/2023 8:33:30 | Cherry | 1 |
6/28/2023 8:33:28 | Banana | 1 |
Hi @OUFores,
You can try to use the following formula if it suitable for your requirement:
formula =
CALCULATE (
COUNTROWS ( TableName ),
FILTER (
TableName,
TableName[Text String] = EARLIER ( TableName[Text String] )
&& TableName[Timestamp]
>= MAX ( TableName[Timestamp] ) - TIME ( 0, 1, 0 )
)
)
Regards,
Xiaoxin Sheng