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
mapman1980
Regular Visitor

Quarterly Growth Calculation

Hello!

 

I'm calculating the average growth rates of some sale values for each quarter. I had to convert the quarters into numeric values to get it to work though. 

 
Here is the measure I used:

 

Growth Rate from Average Sales =
VAR CurrentQuarter = MAX(Assets[Quarter])
VAR CurrentQuarterSales = CALCULATE(AVERAGE(Assets[Sales]), Assets[Quarter] = CurrentQuarter)
VAR PrevQuarter = MAX(Assets[Quarter]) - 1
VAR PreviousQuarterSales = CALCULATE(AVERAGE(Assets[Sales]), Assets[Quarter] = PrevQuarter)
RETURN
IF(ISBLANK(CurrentQuarterSales) || ISBLANK(PreviousQuarterSales), BLANK(), DIVIDE(CurrentQuarterSales - PreviousQuarterSales, PreviousQuarterSales))

 

Here is the data:

SalesQuarterQlabel
4544Q4 2022
3264Q4 2022
5423Q3 2022
5424Q4 2022
6533Q3 2022
5532Q2 2022
5352Q2 2022
5542Q2 2022
5531Q1 2022
9854Q4 2022
6964Q4 2022
6624Q4 2022
3663Q3 2022
3651Q1 2022
6654Q4 2022
3633Q3 2022
3521Q1 2022
2334Q4 2022
3521Q1 2022
5242Q2 2022
2354Q4 2022
2413Q3 2022
5451Q1 2022
6583Q3 2022
6544Q4 2022
3543Q3 2022
3654Q4 2022
10001Q1 2022
5453Q3 2022
9852Q2 2022
6541Q1 2022
3541Q1 2022

 

When I turn it into a visualisation it shows the quarter as a number (1 instead of Q1 2022). Is there any way of calculating the growth and then in the visualisation showing the % growth against the quarter as written in the Qlabel column (Q1 2022)?

 

Here is the visualisation currently. the row marked as "4" is the growth from Q3 2022 to Q4 2022.

mapman1980_1-1679321467665.png

 


 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Set up a proper date table, marked as a date table, and you can use

Growth Rate from Average Sales =
VAR CurrentQuarterSales =
    CALCULATE ( AVERAGE ( Assets[Sales] ), DATESQTD ( 'Date'[Date] ) )
VAR PreviousQuarterSales =
    CALCULATE (
        AVERAGE ( Assets[Sales] ),
        DATEADD ( DATESQTD ( 'Date'[Date] ), -1, QUARTER )
    )
RETURN
    IF (
        ISBLANK ( CurrentQuarterSales ) || ISBLANK ( PreviousQuarterSales ),
        BLANK (),
        DIVIDE ( CurrentQuarterSales - PreviousQuarterSales, PreviousQuarterSales )
    )

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

Set up a proper date table, marked as a date table, and you can use

Growth Rate from Average Sales =
VAR CurrentQuarterSales =
    CALCULATE ( AVERAGE ( Assets[Sales] ), DATESQTD ( 'Date'[Date] ) )
VAR PreviousQuarterSales =
    CALCULATE (
        AVERAGE ( Assets[Sales] ),
        DATEADD ( DATESQTD ( 'Date'[Date] ), -1, QUARTER )
    )
RETURN
    IF (
        ISBLANK ( CurrentQuarterSales ) || ISBLANK ( PreviousQuarterSales ),
        BLANK (),
        DIVIDE ( CurrentQuarterSales - PreviousQuarterSales, PreviousQuarterSales )
    )

Thank you very much, that works perfectly and just as intended.

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.

Top Solution Authors