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
EnochS
Helper II
Helper II

Rolling Average 5 Week Part 2

In my previous help request, we found the solution, and I was able to replicate this process with other tables successfully. For some reason, though, I'm having trouble replicating this same process to a third table, Data Here. Maybe I've been looking at it too much to not be able to see the simple problem (hopefully it's an easy fix) and thought maybe someone from the PBI community could spot it:

 

 

% Exp Sum is not necessary, i think, since the custom column of % Expense exists.. I was just trying to copy the other solutions*

% Exp Sum = SUM(T_Revenue_Expense_Data[% Expense]) 

 

% Exp 5W Avg 2 = calculate( 

AVERAGE(T_Revenue_Expense_Data[% Exp Sum]) ,

DATESINPERIOD (
        T_Revenue_Expense_Data[Date],
        LASTDATE ( T_Revenue_Expense_Data[Date].[Date]),
        -35,
        DAY
    )
)

 

 

Expense 5W AVG Issue.JPG

 

I'm trying to create an average of the last 5 weeks expense to revenue ratio/percentage..

 

 

I want to make it look like this:

 

Expense 5W AVG Issue Report Example.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Any details will help.

@v-ljerr-msft

 

 

Thank you!

1 ACCEPTED SOLUTION
Eric_Zhang
Employee
Employee

@EnochS

Try

 

% Exp Sum = 
SUMX (
    FILTER (
        T_Revenue_Expense_Data,
        T_Revenue_Expense_Data[Date] = EARLIER ( T_Revenue_Expense_Data[Date] )
    ),
    T_Revenue_Expense_Data[% Expense]
)
% Exp 5W Avg 2 = 
AVERAGEX (
    FILTER (
        T_Revenue_Expense_Data,
        T_Revenue_Expense_Data[Date]
            >= EARLIER ( T_Revenue_Expense_Data[Date] ) - 35
            && T_Revenue_Expense_Data[Date] <= EARLIER ( T_Revenue_Expense_Data[Date] )
    ),
    T_Revenue_Expense_Data[% Exp Sum]
)

Capture.PNG

 

 

View solution in original post

2 REPLIES 2
Eric_Zhang
Employee
Employee

@EnochS

Try

 

% Exp Sum = 
SUMX (
    FILTER (
        T_Revenue_Expense_Data,
        T_Revenue_Expense_Data[Date] = EARLIER ( T_Revenue_Expense_Data[Date] )
    ),
    T_Revenue_Expense_Data[% Expense]
)
% Exp 5W Avg 2 = 
AVERAGEX (
    FILTER (
        T_Revenue_Expense_Data,
        T_Revenue_Expense_Data[Date]
            >= EARLIER ( T_Revenue_Expense_Data[Date] ) - 35
            && T_Revenue_Expense_Data[Date] <= EARLIER ( T_Revenue_Expense_Data[Date] )
    ),
    T_Revenue_Expense_Data[% Exp Sum]
)

Capture.PNG

 

 

@Eric_Zhang,

 

Thank you!!

For educational purposes, was there a specific reason why the method I was trying to use didn't work like it did in the other tables?

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.