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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
racope
Frequent Visitor

Creating a measure filtering average sales for 12 month period prior to the last 12 Mos

I currently have a measure (AvgSalesLast12Mos) which calculates average sales for the previous 12 month period.  The measure uses another measure called Avg Sales which is calculated by dividing Total Sales / Total Business Days.  The AvgSalesLast12Mos measure was created using DAX listed below.  I need to create another measure which calculates average sales for the 12 month period which preceeds the last 12 months used in AvgSalesLast12Mos.  Can I specify a different interval with the DATESINPERIOD command or do I have to use another method to calculate this new measure?

AvgSalesLast12Mos =
CALCULATE (
[Avg Sales],
DATESINPERIOD ('Date'[fulldatealternatekey], MAX ('Date'[fulldatealternatekey] ), -13, MONTH )
 
Thanks, 
 
RACope
 
1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @racope,

 

You may try this Measure.

AvgForDatesInPast =
VAR minDate =
    CALCULATE (
        MIN ( 'Date'[fulldatealternatekey] ),
        DATESINPERIOD (
            'Date'[fulldatealternatekey],
            MAX ( 'Date'[fulldatealternatekey] ),
            -13,
            MONTH
        )
    ) - 1
RETURN
    CALCULATE (
        [avg sales],
        DATESINPERIOD ( 'Date'[fulldatealternatekey], minDate, -13, MONTH )
    )

 

Then, the result should look like this.

vcazhengmsft_0-1652854962699.png

 

Also, attach the pbix file as reference.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

2 REPLIES 2
v-cazheng-msft
Community Support
Community Support

Hi @racope,

 

You may try this Measure.

AvgForDatesInPast =
VAR minDate =
    CALCULATE (
        MIN ( 'Date'[fulldatealternatekey] ),
        DATESINPERIOD (
            'Date'[fulldatealternatekey],
            MAX ( 'Date'[fulldatealternatekey] ),
            -13,
            MONTH
        )
    ) - 1
RETURN
    CALCULATE (
        [avg sales],
        DATESINPERIOD ( 'Date'[fulldatealternatekey], minDate, -13, MONTH )
    )

 

Then, the result should look like this.

vcazhengmsft_0-1652854962699.png

 

Also, attach the pbix file as reference.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Whitewater100
Solution Sage
Solution Sage

Hi:

You can try:

result = CALCULATE([avg sales],PARALLELPERIOD('Dates'[Date],-1,YEAR))  ..you can change how many years back, this will give you a 12 month answer. I hope this helps.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.