Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Counting Active Processes

I want to create a calculated table or measure or visual which takes in a date and returns the count of the amount of processes which were in progress on that date.

 

For example:

 

Processstart timeend time time periodCount active
A15 12
B24 24
C69 33
D12 44
E47 55
F29 64
G55 74
H57 82
    92

 

I want to turn the data on the left into the data on the right.

This would be easy enought to do in power query, however I need the table on the right to change when a user filters the table on the left. 

Any Ideas on how to get this done? It might be possible to create a custom visual to do it, but I'm checking whether there is a better way before I dive into that.

  • Anonymous's avatar
    Anonymous
    3 years ago

    I managed to get this to work how I wanted it to.

     

    the table on the left is named ExampleData.

     

    First I created a table of times from the data:

     

    TimeTable = GENERATESERIES(MIN('ExampleData'[start time]),MAX('ExampleData'[end time]))
     
    Then I used the following measure :
     
    ActiveProcesses =
    var MaxTime = MAX('TimeTable'[Value])
    var MinTime = MIN('TimeTable'[Value])
    RETURN
    CALCULATE(COUNT('ExampleData'[Process])+0,
    MaxTime >= 'ExampleData'[start time],
    MinTime <= 'ExampleData'[end time])
     
    Then I am able to plot 'Timetable'[value] against ActiveProcesses for the desired effect.

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I managed to get this to work how I wanted it to.

     

    the table on the left is named ExampleData.

     

    First I created a table of times from the data:

     

    TimeTable = GENERATESERIES(MIN('ExampleData'[start time]),MAX('ExampleData'[end time]))
     
    Then I used the following measure :
     
    ActiveProcesses =
    var MaxTime = MAX('TimeTable'[Value])
    var MinTime = MIN('TimeTable'[Value])
    RETURN
    CALCULATE(COUNT('ExampleData'[Process])+0,
    MaxTime >= 'ExampleData'[start time],
    MinTime <= 'ExampleData'[end time])
     
    Then I am able to plot 'Timetable'[value] against ActiveProcesses for the desired effect.