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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Charu
Post Patron
Post Patron

Month on Month Growth percentage calculation based on Month Number/Month Name using DAX

Dear Community members,

 

Hope all are doing well!

 

There is a scenario where we need to compute month-on-month growth percentage calculation based on the Month number or month name in the data.

Please Help me with the possibilities in Power BI.

 

Sample data is here for your reference

 

MonthNum |  MonthName | Revenue

                 1 |              Jan    |          100

                 2 |              Feb   |           120

                 3 |              Mar  |            150

 

Expected output:

 

MonthNum |  MonthName | Revenue     | Growth %

                 1 |              Jan    |          100    |

                 2 |              Feb   |          120    |  20%

                 3 |              Mar  |           150   |   30%

Growth % is the simple calculation that is current month revenue- previous month revenue.

 

This dataset doesn't contain any date values that's the challenging part here. Kindly please help me out on this

 

Thanks and Regards,

Charu

2 ACCEPTED SOLUTIONS
AllisonKennedy
Super User
Super User

@Charu , even though the dataset does not have date values, create a DateKey column and also create a DimDate table. Both are explained how to in my blog here: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html 

For you to create the DateKey column, you'll need to do it manually. You can merge Year and Month Number and 01 to get the date key required. 

Now just use simple time intelligence to calculate

 

Revenue = SUM(Revenue)

Prev Month Revenue = CALCULATE( [Revenue], DATEADD(DimDate[Date], -1, Month) )

Growth % = DIVIDE ( [Revenue - [Prev Month Revenue], [Prev Month Revenue])


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

v-lionel-msft
Community Support
Community Support

Hi @Charu ,

 

Please try the formula.

Measure = 
VAR x = 
CALCULATE(
    MAX('Table (2)'[Revenue]),
    FILTER(
        ALLSELECTED('Table (2)'),
        'Table (2)'[MonthNum] = MAX('Table (2)'[MonthNum]) - 1
    )
)
RETURN
CALCULATE(
    DIVIDE(
        MAX('Table (2)'[Revenue]) - x,
        100
    ),
    FILTER(
        'Table (2)',
        x <> BLANK()
    )
)

 

v-lionel-msft_0-1615862953099.png

Note: 

But there is a problem here. Since you don't have a year column, if you have multiple repeated months, how do you want to calculate it?

 

Best regards,
Lionel Chen

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

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @Charu ,

 

Please try the formula.

Measure = 
VAR x = 
CALCULATE(
    MAX('Table (2)'[Revenue]),
    FILTER(
        ALLSELECTED('Table (2)'),
        'Table (2)'[MonthNum] = MAX('Table (2)'[MonthNum]) - 1
    )
)
RETURN
CALCULATE(
    DIVIDE(
        MAX('Table (2)'[Revenue]) - x,
        100
    ),
    FILTER(
        'Table (2)',
        x <> BLANK()
    )
)

 

v-lionel-msft_0-1615862953099.png

Note: 

But there is a problem here. Since you don't have a year column, if you have multiple repeated months, how do you want to calculate it?

 

Best regards,
Lionel Chen

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

 

Hi @v-lionel-msft ,

 

Foremost thank you for your DAX code it works as expected. And Yes, you are correct without the Date key field it's tough to analyze.  So planning for the data model with the date keys and will ease the DAX too.

 

Thank you for your valuable feedback

AllisonKennedy
Super User
Super User

@Charu , even though the dataset does not have date values, create a DateKey column and also create a DimDate table. Both are explained how to in my blog here: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html 

For you to create the DateKey column, you'll need to do it manually. You can merge Year and Month Number and 01 to get the date key required. 

Now just use simple time intelligence to calculate

 

Revenue = SUM(Revenue)

Prev Month Revenue = CALCULATE( [Revenue], DATEADD(DimDate[Date], -1, Month) )

Growth % = DIVIDE ( [Revenue - [Prev Month Revenue], [Prev Month Revenue])


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi @AllisonKennedy 

 

Like you said, going with the date keys in the data set is a great way to work on this time intelligence calculations. Thank you so much for your suggestion and timely help.

 

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!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.