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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

DYNAMIC QUARTER MOVIL

Hi everybody

 

I want to create a measure that give me QUARTERL SALES, for example:

 

SALES1 = JAN, FEB, MAR      (IN MARCH)

SALES2 = FEB, MAR, APR      (IN APRIL)

SALES3 = MAR, APR, MAY      (IN MAY)

SALES4 = APR, MAY, JUN      (IN JUNE)

SALES 5 = MAY, JUN, JUL      (IN JULY)

.

.

.

 

I tried this:

 

VAR Date1= Max(Calendar[Date])

VAR Date2 = Date1 - 1

VAR Date3 = Date1 - 2

RETURN CALCULATE([Sales];Calendar[Date]=Date1) + CALCULATE([Sales];Calendar[Date]=Date2) + CALCULATE([Sales];Calendar[Date]=Date3)

 

But I did not make it. I was learning using DAX

 

 

1 ACCEPTED SOLUTION
vivran22
Community Champion
Community Champion

Hello @Anonymous ,

 

Try this:

 

Qtr Sum2 = 

VAR _StartMonth = 
MAX(Calendar[Date])


VAR _QtrSum = 
    CALCULATE(
        [Sales],
        DATESINPERIOD(Calendar[Date],_StartMonth,-3,MONTH)
    )

RETURN

_QtrSum

 

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

View solution in original post

2 REPLIES 2
vivran22
Community Champion
Community Champion

Hello @Anonymous ,

 

Try this:

 

Qtr Sum2 = 

VAR _StartMonth = 
MAX(Calendar[Date])


VAR _QtrSum = 
    CALCULATE(
        [Sales],
        DATESINPERIOD(Calendar[Date],_StartMonth,-3,MONTH)
    )

RETURN

_QtrSum

 

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

Anonymous
Not applicable

The measure works very well!! Eres un crack !!!

 

Share the result:

 

EQC Promotores 3MM =

VAR _StarMonth = MAX('BD Calidad Venta'[FECHA])
VAR _QtrSum = CALCULATE(
[EQC Promotores Acum.];
DATESINPERIOD('BD Calidad Venta'[FECHA];_StarMonth;-3;MONTH)
)
RETURN
_QtrSum
 
Thanksss !!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

October NL Carousel

Fabric Community Update - October 2024

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

Top Solution Authors