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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
vissvess
Helper V
Helper V

Cumulative number of units under processing / count time within duration

Hi,

 

My data set is as follows.

 

DateUnitStart TimeEnd Time
20-09-19GRK9W21:53:53 AM9:05:02 PM
20-09-19HBRK9W4:53:17 AM11:47:37 PM
20-09-19GBRK9W5:04:23 AM1:18:04 PM
20-09-19DFRK9W5:53:17 AM3:48:21 PM
20-09-198CRK9W11:25:00 AM2:55:04 PM
20-09-191KRK9W1:02:35 AM2:17:55 AM
20-09-192KRK9W1:00:41 AM5:27:28 PM
20-09-193KRK9W11:38:31 AM2:14:31 PM
20-09-19HGRK9W1:39:53 AM5:16:52 PM
20-09-194KRK9W3:29:14 AM11:28:58 PM
20-09-19BGRK9W9:40:37 AM1:45:38 PM

 

I also have a date and time table as follows.New11.JPG

 

New12.JPG

 

With these tables, the relationship is with the date with date and process dataset. Time relation with time table and process table's End Time column.

 

I need a trend for particular day accross time all open orders at any given time. 

For a unit, between start time and end time, the unit is said to be open order. 

So, at a particular time, the value would be number of open orders, i.e., orders having lesser or equal selected time and greater end time.

 

Kindly help me in this regard.

Many thanks

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi @vissvess,

not sure what you are after.
This measure

Measure =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Unit] );
    FILTER (
        'Table';
        'Table'[Start Time] <= SELECTEDVALUE ( 'Time'[Time] )
            && SELECTEDVALUE ( 'Time'[Time] ) <= 'Table'[End Time]
    )
)

can be used to show the change in open orders during the day:
Cumulative number of units under processing.PNG

regards,
Sturla

View solution in original post

11 REPLIES 11
sturlaws
Resident Rockstar
Resident Rockstar

Hi @vissvess,

not sure what you are after.
This measure

Measure =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Unit] );
    FILTER (
        'Table';
        'Table'[Start Time] <= SELECTEDVALUE ( 'Time'[Time] )
            && SELECTEDVALUE ( 'Time'[Time] ) <= 'Table'[End Time]
    )
)

can be used to show the change in open orders during the day:
Cumulative number of units under processing.PNG

regards,
Sturla

HI @sturlaws ,

 

Thanks for the wornderful code.

I have a date slicer. With the help of this, I get daily trend over hours. 

 

But I select a week or more than a day, the numbers gets summed up.

 

I need either peak of peak of average. A slicer for this to modify the method of aggretation is required. Is it possbile.

Many Thanks

Try this

Measure =
DIVIDE (
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Unit] );
        FILTER (
            'Table';
            'Table'[Start Time] <= SELECTEDVALUE ( 'Time'[Time] )
                && SELECTEDVALUE ( 'Time'[Time] ) <= 'Table'[End Time]
        )
    );
    COUNTROWS ( VALUES ( 'Table'[Date] ) )
)

Hi @sturlaws ,

 

Thanks for the timely help...

 

Lemme check for my expected result.

 

Could you help me in solving similar type of data with some modifications.

Say, I donot have start time. I have something called order which has multiple units.

 

I have a table named "Master list of order" Which have orders and order quantity. 

 

Now this process table may contain the following data. Say,

 

Date --> Order number --> Unit --> Produced time.

 

I have a measure for the build quantity as calculate(distinctcount(Units)) to count the actual number of units produed againsst the order to full fill the order quantity.

 

The requirement is same as earlier dataset.

 

At any point of time, the number of orders that have build quantity not matching with order quantity is to be arrived.

 

Could you kindly help. I am stranded...

I have one to many relationship between Masterlist of orders and Process table. Kindly note.

 

Many thanks for your continual support.

Initially, I thought the work around would be simple. 

 

At the end of my day (When I get my daily data), I will have all the orders built (Order quanity = Build Quantity for almost all orders).

 

So, If I use the above condition I end up in disappointment resulting error or a straight line.


The function may need a time intelligence to neglect the later period orders at any particular period of time to count the open orders.

 

Hope I can have a better workaround. Thanks in advance @sturlaws .

If you can provide a representable sample dataset and mock-up of what you want as outcome, I'll take a look at it

Hi @sturlaws ,

 

The outcome is same as I requested earlier and the same as you provided.

 

The inputs is also the same as before but without start time

Date

Order Number

Unit

Completed Time

20-09-19

82343

GRK9W2

9:05:02 PM

20-09-19

83453

HBRK9W

11:47:37 PM

20-09-19

72354

GBRK9W

1:18:04 PM

20-09-19

83453

DFRK9W

3:48:21 PM

20-09-19

72354

8CRK9W

2:55:04 PM

20-09-19

 83453

1KRK9W

2:17:55 AM

20-09-19

83453

2KRK9W

5:27:28 PM

20-09-19

83453

3KRK9W

2:14:31 PM

20-09-19

72354

HGRK9W

5:16:52 PM

20-09-19

72354

4KRK9W

11:28:58 PM

20-09-19

72354

BGRK9W

1:45:38 PM

 

Now another table - "Masterlist of orders"

Order Number

Order Quantity

72354

8

83453

2

82346

49

92137

15

0123540

 

Now, could you read the earlier post for better understanding of the model and requirement.

 

Again note, the dataset is bit different, but the output required is same.

 

Thanks again.

It is not clear to me what you want your output to look like. Do you want a timeline chart with the number of orders which are not complete yet? Do you want a timeline chart with the number of produced items pr order? If you want a timeline chart, what should the start time be?

Yes... I want a timeline chart with the number of order which are not complete yet.

 

There is not start time as in the earlier case. (earlier unit is open between start and end time)

 

Now the order is open between first and last unit production. Order quanity is available in master table.

At any time, open orders are when the first unit of the order is produced and at the time, the total unit prodcued of the particular order not matching with the specified quantity.

 

Hope now its clear.

 

Many Thansk

@vissvess, did you solve this? 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors