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
Naverie
Helper I
Helper I

Storing hourly data

Hi all,

 

A request has been made to show hourly production data. The PPM is calculated as a whole for what has happened on the production order currently but I'm wanting to store this somehow hourly.

 

The data isn't stored this way as is a calculation that will change at the end of a production order e.g. 30 mins into the order PPM could be 20 as 600 packs have been produced but in another 30 mins it could now be 18 as 1080 have now been produced for that whole hour. 

 

What I'm tryinng to do is store the information in power bi so it can be used to trend performance.

 

Hopefully this makes sense!

1 ACCEPTED SOLUTION

Hi  @Naverie ,

 

First go to query editor>split datetime column to date and time columns and add an index column;

Create a column to get the minute:

 

Minute = MINUTE('Table'[Time])

 

Then create another column as below:

 

Result =
VAR minindex =
    CALCULATE (
        MAX ( 'Table'[Index] ),
        FILTER (
            'Table',
            'Table'[Action] = "Production order starts"
                && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
        )
    )
VAR _sum =
    CALCULATE (
        SUM ( 'Table'[Quantity] ),
        FILTER (
            'Table',
            'Table'[Index] >= minindex
                && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
        )
    )
RETURN
    IF (
        'Table'[Action] = "Production order starts",
        0,
        DIVIDE ( _sum, 'Table'[Minute] )
    )

 

And you will see:

vkellymsft_0-1635319412771.png

If you wanna get the  ideal scenario,you need to first create a dim table as below:

 

dim = GENERATE(GENERATESERIES(0,24,1),SELECTCOLUMNS(GENERATESERIES(0,60,15),"value2",[Value]))

 

Then repeat the above calculation to get result2.

An output is:

vkellymsft_1-1635321820549.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

View solution in original post

8 REPLIES 8
Naverie
Helper I
Helper I

Hi @mwenger,

 

No I haven't as I didn't know this existed.

 

However, looking at the links you've sent they are probably beyond my skill set for Power BI and not sure whether we have the ability to do this as we are using on prem report server.

 

Is there another solution available?

 

Thanks 

 

 

Hi @Naverie 

 

have you taken a look at the streaming dataset/dataflow yet?

https://docs.microsoft.com/en-us/power-bi/connect-data/service-real-time-streaming?WT.mc_id=DP-MVP-5...

https://docs.microsoft.com/en-us/power-bi/transform-model/dataflows/dataflows-streaming?WT.mc_id=DP-...

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegener I think I've found a way round it as the time data is stored.

 

Only thing is I sort of know what I need to do but not sure how to translate it into Power BI to work.

 

So the outputs are stored with a timestamp.

 

For the first output I would need to calculate the PPM from the start of the Production order to that time. It would then keep getting lower as the duration is longer but no more packs have been produced. When the next lot of packs are outputted it would then calculate the new PPM from the start of the order to this timestamp.

 

Is any of that possible? I'm guessing it might be and just need some fancy DAX.

 

Thanks in advance

Hi @Naverie ,

 

I think if you provide an sample file and describe what your expected result is, we can give it a try.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegener sending a sample file will be an issue due to company policies etc. The best I can do for you is below, hopefully, it's ok.

 

Production line 1

DateTimeQuantityActionCalculationResult 
14/10/2021 12:00:000Production order starts   
14/10/2021 12:10:0080Item outputted80/108 ppmPPM up to this point

14/10/2021 12:30:00

80Item outputted160/305.33 ppmPPM up to this point

14/10/2021 12:40:00

80Item outputted240/406.85ppmPPM up to this point

14/10/2021 12:41:00

0Production order ended240/415.85ppmOverall PPM for that production order.

 

This would then be on a line chart for example to see where their performance dips with a KPI changing to the current PPM.

 

The ideal scenario would be to have 15-minute increments along an axis in a chart and the PPM calculated on the fly, e.g.  order starts at 12:00, 80 items outputted at 12:20  so at 12:15 the PPM would be zero. Another lot of 80 items are outputted at 12:35 so at 12:30 the PPM would be 80/30 but at 12:45 the PPM would be 240/45 if another lot of items had been outputted.

 

I'm not sure whether any of that makes sense but not sure how else to explain it. Might have to draw it out if not lol!

 

 

Hi  @Naverie ,

 

First go to query editor>split datetime column to date and time columns and add an index column;

Create a column to get the minute:

 

Minute = MINUTE('Table'[Time])

 

Then create another column as below:

 

Result =
VAR minindex =
    CALCULATE (
        MAX ( 'Table'[Index] ),
        FILTER (
            'Table',
            'Table'[Action] = "Production order starts"
                && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
        )
    )
VAR _sum =
    CALCULATE (
        SUM ( 'Table'[Quantity] ),
        FILTER (
            'Table',
            'Table'[Index] >= minindex
                && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
        )
    )
RETURN
    IF (
        'Table'[Action] = "Production order starts",
        0,
        DIVIDE ( _sum, 'Table'[Minute] )
    )

 

And you will see:

vkellymsft_0-1635319412771.png

If you wanna get the  ideal scenario,you need to first create a dim table as below:

 

dim = GENERATE(GENERATESERIES(0,24,1),SELECTCOLUMNS(GENERATESERIES(0,60,15),"value2",[Value]))

 

Then repeat the above calculation to get result2.

An output is:

vkellymsft_1-1635321820549.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

Hi,

 

Thank you for this. I haven't had chance yet to try it due to other commitments so can't let you know whether this has worked or not. But will when I've tried it out.

 

thanks 

Hi  @Naverie ,

 

Waiting for your update.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

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.

Top Solution Authors