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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count value with conditions in a period of time

Hello everyone,

 

I have a table with 3 columns : 

- column 1 : Value

- Column 2 : employee.

- column 3 : Date and time 

 

I would like to count how many time the values in column 1 are above X during 10 minutes for each employee. 

 

For example, if value in column 1 are above 25 during 10 minutes (column 3) for an employee ( column 2), the formula will count 1. 

 

Many thanks for your help, 

 

 

4 REPLIES 4
Anonymous
Not applicable

create new column whih calculated column3 in minutes.

 

New measure= calculate(count(Table[Employee]),Filter(Table,Table[value]>X && table[New column]>10))

 

 

Thanks & regards,

Pravin Wattamwar

Anonymous
Not applicable

Hello, 

 

Thank you @Anonymous  for your quick response. 

 

Unfortunately, It doesn't work because I didn't explain well the time issue I have. 

 

Please see below a sample of the data : 

 

valueEmployee Date
25Peter30/12/2019 20:10
26Peter30/12/2019 20:11

27

Peter30/12/2019 20:12
28Peter30/12/2019 20:13
28Peter30/12/2019 20:14
29Peter30/12/2019 20:15
30Peter30/12/2019 20:16
31Peter30/12/2019 20:17
32Peter30/12/2019 20:18
33Peter30/12/2019 20:19
34Peter30/12/2019 20:20
32Peter30/12/2019 20:21
33Peter

30/12/2019 20:22

34Peter30/12/2019 20:23

 

I  would like a formula which counts how many times values have been above 25 for at least 10 minutes. In this case, between 30/12/2019 20:10 and 30/12/2019 20:23 (13 minutes) values are above 25 for Peter and the formula should count 1. 

 

Do you have any idea ? 

 

Many thanks for your help, 

 

Ilyas, 

Hi @Anonymous ,
 
According to my understanding, your problem type is circular iteration, and DAX can't solve this kind of problem temporarily. You can use Python script or R script to solve this problem.
 
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Try to create index column and get difference in minutes by using datediff.
Then apply the above which i have given.

Get reference from below post.
https://community.powerbi.com/t5/Desktop/get-value-from-Previous-row/td-p/441336


Thanks & regards,
Pravin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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