The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
User | Count |
---|---|
24 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |