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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.