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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
DineshArivu
Helper I
Helper I

Rolling 4 hours average

Hi Experts,

DineshArivu_0-1773405353547.png

 

Add one more column "Rolling 4 hours Average", it has to map current row MIPS value + previous 3 , then divided by 4.
we have a slicers to filter by region, by month, by date.

after this "Rolling 4 hours Average" created, we have to calculate MAX MIPS value without 4 hours rolling by Month and MAX MIPS value with 4 hours rolling by month.

 

I have tried the below DAX by result is not as expected.

Rolling 4h Avg (strict ÷ 4) =
VAR RelationDistinct =
    SUMMARIZE (
        ALLSELECTED ( 'VW_MF_TRANSACTIONS' ),
        'VW_MF_TRANSACTIONS'[LPAR],
        'VW_MF_TRANSACTIONS'[MetricDateTime_1]
    )
VAR W =
    WINDOW (
        -3, 0,
        RelationDistinct,
        ORDERBY ( 'VW_MF_TRANSACTIONS'[MetricDateTime_1], ASC ),
        PARTITIONBY ( 'VW_MF_TRANSACTIONS'[LPAR] )
    )
VAR Sum4 = SUMX ( W, [MAX MIPS])
RETURN DIVIDE ( Sum4, 4 )
 
Please help to fix this asap.

Thanks DK
5 REPLIES 5
v-pgoloju
Community Support
Community Support

Hi @DineshArivu,


Just following up to see if the Response provided by community members were helpful in addressing the issue.  If the issue still persists, we kindly request you to share the sample data in a workable format such as text, an Excel file, or a PBIX file with sample data instead of screenshots. Additionally, please include the expected output. This will enable us to assist you more effectively.

 

Thanks & Regards,

Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @DineshArivu,


Just following up to see if the Response provided by community members were helpful in addressing the issue.  If the issue still persists, we kindly request you to share the sample data in a workable format such as text, an Excel file, or a PBIX file with sample data instead of screenshots. Additionally, please include the expected output. This will enable us to assist you more effectively.

 

Thanks & Regards,

Prasanna Kumar

 

DineshArivu
Helper I
Helper I

Hi Experts,

As per my requirement, I have to showcase rolling 4 hours average MIPS values - MIPS = Processing power of your mainframe (higher = more work being done)
I have already created a measure and applied in a new sample page with sample columns and it looks OK when I used to add with few columns with external filters as below :

DineshArivu_0-1773651462533.png

1st 3 rows blank as we don't have strictly 4 rows previously (12am,1am,2am only there) to calculate 4hrs rolling, from the 4th row the calculation starts and giving the expected value as a result.

DineshArivu_0-1773651790087.png

 

but the same measure is not working as expected when it applies to original table (More fields) as below :

it should work with or without any external filters applied .

DineshArivu_2-1773651462977.png

 

 

DAX i used :

Rolling 4h Avg__ =
 VAR RelationDistinct = SUMMARIZE ( ALLSELECTED ( 'VW_MF_TRANSACTIONS' ), 'VW_MF_TRANSACTIONS'[LPAR]'VW_MF_TRANSACTIONS'[SERIAL]'VW_MF_TRANSACTIONS'[WDID],'VW_MF_TRANSACTIONS'[CLIENT_NAME],'VW_MF_TRANSACTIONS'[MetricDateTime_1] )
 VAR W = WINDOW ( -30RelationDistinctORDERBY ( 'VW_MF_TRANSACTIONS'[MetricDateTime_1]ASC ), PARTITIONBY ( 'VW_MF_TRANSACTIONS'[LPAR]'VW_MF_TRANSACTIONS'[SERIAL],'VW_MF_TRANSACTIONS'[WDID]'VW_MF_TRANSACTIONS'[CLIENT_NAME]) )
 VAR Rows4 = COUNTROWS ( W ) VAR Sum4 = SUMX ( W[MAX MIPS] )
RETURN IF ( Rows4 = 4DIVIDE ( Sum44 ), BLANK() )
 
Please help to sort this asap .

Thanks
DK
jgeddes
Super User
Super User

Maybe something like this will work for you...
Create a calculated column

Rolling 4 Hours Average = 
var _fourHours = 
[DateTime] - (1/24*4)
var _currTime = 
[DateTime]
var _result = 
SUMX(FILTER('Table', 'Table'[LPAR] = [LPAR] && ('Table'[DateTime] <= _currTime) && 'Table'[DateTime] >= _fourHours), [MIPS])/4
RETURN
_result

 

Create measure

Max MIPS = 
var _max = 
SUMMARIZE(
    ALLSELECTED('Table'),
    'Table'[DateTime].[Year],
    'Table'[DateTime].[Month],
    "__max", DIVIDE(MAX('Table'[MIPS]), MAX('Table'[Rolling 4 Hours Average]))
)
RETURN
MAXX(_max, [__max])

 

It may not be the exact answer, but it should get you pointed in the right direction.





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

Proud to be a Super User!





@jgeddes Thanks for your solution. Unfortunately your rolling avg DAX taking very long time to create and not finished. It may be related to huge rows.

I have already created a measure for this and it looks OK when I used to add with few columns as below :

DineshArivu_0-1773650625056.png

1st 3 rows blank as we don't have strictly 4 rows to calculate 4hrs rolling, from the 4th row the calculation starts and giving the expected value as a result.

DineshArivu_1-1773650766442.png

 

but the same measure is not working as expected when it applies to original table (More fields) as below :

DineshArivu_2-1773651124960.png

 

DAX i used :

Rolling 4h Avg__ =
 VAR RelationDistinct = SUMMARIZE ( ALLSELECTED ( 'VW_MF_TRANSACTIONS' ), 'VW_MF_TRANSACTIONS'[LPAR], 'VW_MF_TRANSACTIONS'[SERIAL], 'VW_MF_TRANSACTIONS'[WDID],'VW_MF_TRANSACTIONS'[CLIENT_NAME],'VW_MF_TRANSACTIONS'[MetricDateTime_1] )
 VAR W = WINDOW ( -3, 0, RelationDistinct, ORDERBY ( 'VW_MF_TRANSACTIONS'[MetricDateTime_1], ASC ), PARTITIONBY ( 'VW_MF_TRANSACTIONS'[LPAR], 'VW_MF_TRANSACTIONS'[SERIAL],'VW_MF_TRANSACTIONS'[WDID], 'VW_MF_TRANSACTIONS'[CLIENT_NAME]) )
 VAR Rows4 = COUNTROWS ( W ) VAR Sum4 = SUMX ( W, [MAX MIPS] )
RETURN IF ( Rows4 = 4, DIVIDE ( Sum4, 4 ), BLANK() )
 
Please help to sort this asap .

Thanks
DK

 

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.