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
Anonymous
Not applicable

7 Day Moving Average Group By Latest selected date

 

Hi All,

 

Can you please provide the Dax formula to achieve the output from the below. Please find the below expression i am using as dax expression that is not working. In report used is production date and slicer as Record date.

 

CALCULATE([GasProduction (Sum)],ALLSELECTED(Well),DATESINPERIOD('Procount Record Date'[Date],LASTDATE('Procount Record Date'[Date]),-7,DAY))/7
 
Input:

 

image.png

Desired Result:

 

image.png

 

1 ACCEPTED SOLUTION

@Anonymous,

 

Change 7 with 8:

7 day average = 
CALCULATE (
    SUM ( 'Procount Record Date'[Value] ),
    DATESINPERIOD (
        'Procount Record Date'[Date],
        LASTDATE ( 'Procount Record Date'[Date] ),
        -8,
        DAY
    )
)
    / 7

Capture.PNG 

Community Support Team _ Jimmy Tao

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

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

@Anonymous,

 

Modify Measure like pattern below and check if it can meet your requirement:

Result =
CALCULATE (
    [GasProduction (Sum)],
    FILTER (
        'Procount Record Date',
        'Procount Record Date'[RelatedColumn] IN VALUES ( Well[RelatedColumn] )
    ),
    DATESINPERIOD (
        'Procount Record Date'[Date],
        LASTDATE ( 'Procount Record Date'[Date] ),
        -7,
        DAY
    )
)
    / 7

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

I am modifying the DAX expression as below. Can you please share the desired DAX expression where the output show as in 2nd screen shot.

 

CALCULATE(
SUM(Procount[Net Flow Rate]),
DATESINPERIOD(Procount[Record Date],LASTDATE(Procount[Record Date]),-7,DAY))
/
7

@Anonymous,

 

Change 7 with 8:

7 day average = 
CALCULATE (
    SUM ( 'Procount Record Date'[Value] ),
    DATESINPERIOD (
        'Procount Record Date'[Date],
        LASTDATE ( 'Procount Record Date'[Date] ),
        -8,
        DAY
    )
)
    / 7

Capture.PNG 

Community Support Team _ Jimmy Tao

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

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.