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

Display distribution of a calculated Running Totals

For every minute I want to calculate the total number of cases picked in the last 3 minutes.

I then want to take each calculated minute and see the distribution of those by minute calculations.

I'm searching for bursts of picking speed over 3 minutes and want to display that.

 

I can calculate the running total in a column and then plot that column.

However, my table is > 800,000 rows and will get larger. It takes a long time to calculate the running total column.

 

Is there another way to calculate the distributions of the running total vs making a column?

Or have you seen websites, videos or tutorials that do this?

 

briguin_0-1635098811113.png

briguin_1-1635099019636.png

 

 

I also know how to calculate the measure in a DAX Measure but can't figure out if I can do a distribution of a calculated measure.

 

 

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @briguin 

Create a table to be X axis in visual and create a measure to count.

Table:

X axis = 
VAR _T =
    ADDCOLUMNS (
        Question_Sample,
        "3min_Running_Total",
            CALCULATE (
                SUM ( Question_Sample[Cases_Picked] ),
                FILTER (
                    Question_Sample,
                    Question_Sample[Timestamp] <= EARLIER ( Question_Sample[Timestamp] )
                        && Question_Sample[Timestamp]
                            > EARLIER ( Question_Sample[Timestamp] ) - TIME ( 0, 3, 0 )
                        && Question_Sample[Pick_Area] = EARLIER ( Question_Sample[Pick_Area] )
                        && NOT ( ISBLANK ( Question_Sample[Timestamp] ) )
                )
            )
    )
VAR _Xaxis =
    GENERATESERIES (
        MINX ( _T, [3min_Running_Total] ),
        MAXX ( _T, [3min_Running_Total] )
    )
RETURN
    _Xaxis

Measure:

Count = 
VAR _T =
    ADDCOLUMNS (
        Question_Sample,
        "3min_Running_Total",
            CALCULATE (
                SUM ( Question_Sample[Cases_Picked] ),
                FILTER (
                    Question_Sample,
                    Question_Sample[Timestamp] <= EARLIER ( Question_Sample[Timestamp] )
                        && Question_Sample[Timestamp]
                            > EARLIER ( Question_Sample[Timestamp] ) - TIME ( 0, 3, 0 )
                        && Question_Sample[Pick_Area] = EARLIER ( Question_Sample[Pick_Area] )
                        && NOT ( ISBLANK ( Question_Sample[Timestamp] ) )
                )
            )
    )
RETURN
    COUNTAX (
        FILTER ( _T, [3min_Running_Total] = SUM ( 'X axis'[Value] ) ),
        [3min_Running_Total]
    )

Result is the as you create a calculated column.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @briguin 

Create a table to be X axis in visual and create a measure to count.

Table:

X axis = 
VAR _T =
    ADDCOLUMNS (
        Question_Sample,
        "3min_Running_Total",
            CALCULATE (
                SUM ( Question_Sample[Cases_Picked] ),
                FILTER (
                    Question_Sample,
                    Question_Sample[Timestamp] <= EARLIER ( Question_Sample[Timestamp] )
                        && Question_Sample[Timestamp]
                            > EARLIER ( Question_Sample[Timestamp] ) - TIME ( 0, 3, 0 )
                        && Question_Sample[Pick_Area] = EARLIER ( Question_Sample[Pick_Area] )
                        && NOT ( ISBLANK ( Question_Sample[Timestamp] ) )
                )
            )
    )
VAR _Xaxis =
    GENERATESERIES (
        MINX ( _T, [3min_Running_Total] ),
        MAXX ( _T, [3min_Running_Total] )
    )
RETURN
    _Xaxis

Measure:

Count = 
VAR _T =
    ADDCOLUMNS (
        Question_Sample,
        "3min_Running_Total",
            CALCULATE (
                SUM ( Question_Sample[Cases_Picked] ),
                FILTER (
                    Question_Sample,
                    Question_Sample[Timestamp] <= EARLIER ( Question_Sample[Timestamp] )
                        && Question_Sample[Timestamp]
                            > EARLIER ( Question_Sample[Timestamp] ) - TIME ( 0, 3, 0 )
                        && Question_Sample[Pick_Area] = EARLIER ( Question_Sample[Pick_Area] )
                        && NOT ( ISBLANK ( Question_Sample[Timestamp] ) )
                )
            )
    )
RETURN
    COUNTAX (
        FILTER ( _T, [3min_Running_Total] = SUM ( 'X axis'[Value] ) ),
        [3min_Running_Total]
    )

Result is the as you create a calculated column.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Employee
Employee

To do it as a measure (not sure it will be faster but worth trying), you can make a disconnected table with all the potential values for your x axis (e.g., with GENERATESERIES), and then write a measure that creates a virtual summary table of 3 minute speeds and count the rows of that table FILTERed to the SELECTEDVALUE of your disconnected table.

 

You could also consider adding a column with time rounded to 3-minute intervals to further simplify things.  But if you need a 3 minute total for every minute, that won't work.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.