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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Lucasr46
New Member

Last 7 days AVARAGE

Hello everyone. How it's going?

 

I need to create an avarage of the requests made of the last 7 days.

 

Each line of the table is a request.

Lucasr46_0-1681310679298.png

 

 

The collum "Prazo separacao" is my date.

Lucasr46_1-1681310748450.png

 

 

Please, who can help me?

2 REPLIES 2
FreemanZ
Super User
Super User

hi @Lucasr46 

it depends on the starting point of last 7 days, if you mean Today/Now, try like:

Measure = 
DIVIDE(
    SUMX(
        FILTER(
           Data,
           Data[Date]>NOW()-7&&Data[Date]<=NOW()
        ),
        Data[Qty]
    ),
    7
)
MohammadLoran25
Solution Sage
Solution Sage

Hi @Lucasr46 ,

Use this measure:

 

Measure =
VAR _MAXDATE =
    CALCULATE ( MAX ( RequestTable[Date] ), ALL ( RequestTable ) )
RETURN
    DIVIDE (
        CALCULATE (
            SUM ( RequestTable[Request] ),
            FILTER (
                RequestTable,
                RequestTable[Date] <= _MAXDATE
                    && RequestTable[Date] >= _MAXDATE - 6
            )
        ),
        CALCULATE (
            COUNTROWS ( VALUES ( RequestTable[Date] ) ),
            FILTER (
                RequestTable,
                RequestTable[Date] <= _MAXDATE
                    && RequestTable[Date] >= _MAXDATE - 6
            )
        )
    )

 

If this answer solves your problem, give it a thumbs up and mark it as an accepted solution so the others would find what they need easier.

Regards,
Loran

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.