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
ddbaker
Helper I
Helper I

Calculating Upgrade, Downgrade, New, and Canceled MRR For Each Month

Alright Power BI family, I've tried everything to make this work, and I need your help!

I'm creating a revenue report for a client, and I have been able to calculate their new, canceled, upgrade, and downgrade MRR, but I can't get the totals to add up correctly:

ddbaker_0-1640049053599.png

Here are all the relevant measures:

 

MRR = 
CALCULATE(
    SUM(Subscriptions[MRR Amount]),
    Subscriptions[Status] <> "canceled"
)
MRR (Current) = 
VAR t1 = 
    SUMMARIZE(
        Subscriptions,
        Customers[Customer ID],
        'Calendar'[Month Year],
        "MRR",
        _Measures[MRR]
    )
RETURN
SUMX(
    t1,
    [MRR]
)
MRR (Previous) = 
VAR CurrentMonth = SELECTEDVALUE('Calendar'[Month])
VAR CurrentYear = SELECTEDVALUE('Calendar'[Year])
VAR MaxMonthNum = CALCULATE(MAX('Calendar'[Month]), ALL('Calendar'))

RETURN
IF(
    HASONEVALUE('Calendar'[Month]),
    SUMX(
        FILTER(
            ALL('Calendar'),
            IF(
                CurrentMonth = 1,
                'Calendar'[Month] = MaxMonthNum && 'Calendar'[Year] = CurrentYear - 1,
                'Calendar'[Month] = CurrentMonth - 1 && 'Calendar'[Year] = CurrentYear
            )
        ),
        _Measures[MRR]
    ),
    BLANK()
)
MRR (Change) = 
_Measures[MRR (Current)] - _Measures[MRR (Previous)]
New MRR = 
VAR CustomerList = VALUES(Customers[Customer ID])
RETURN
SUMX(
    FILTER(
        CustomerList,
        _Measures[MRR (Previous)] = 0
    ),
    [MRR (Change)]
)
Churned Customer MRR = 
VAR CustomerList = VALUES(Customers[Customer ID])
RETURN
SUMX(
    FILTER(
        CustomerList,
        _Measures[MRR (Current)] = 0
    ),
    [MRR (Change)]
)
Upgrade MRR = 
VAR CustomerList = VALUES(Customers[Customer ID])
RETURN
SUMX(
    FILTER(
        CustomerList,
        _Measures[MRR (Previous)] < [MRR (Current)] && _Measures[MRR (Previous)] <> 0
    ),
    [MRR (Change)]
)
Downgrade MRR = 
VAR CustomerList = VALUES(Customers[Customer ID])
RETURN
SUMX(
    FILTER(
        CustomerList,
        _Measures[MRR (Previous)] > _Measures[MRR (Current)] && _Measures[MRR (Current)] <> 0
    ),
    [MRR (Change)]
)

 

I know that I need to include a Month Year column in my SUMX, but when I try the measure below, I get different values for the monthly totals (and I know the ones shown in my previous screenshot are correct).

 

Upgrade MRR = 
VAR t1 = 
SUMMARIZE(
        Subscriptions,
        Customers[Customer ID],
        'Calendar'[Month Year],
        "MRR Change",
        _Measures[MRR (Change)]
    )
RETURN
SUMX(
    FILTER(
        t1,
        _Measures[MRR (Previous)] < [MRR (Current)] && _Measures[MRR (Previous)] <> 0
    ),
    [MRR Change]
)

 

Also, here is a link to my PowerBI file. Thank you so much for your help with this!

1 ACCEPTED SOLUTION

Hi @ddbaker ,

Please create a new measure as follows, instead of updating the original measure [Churned Customer MRR]. Later put this new measure in the matrix visual to replace the measure [Churned Customer MRR]...

New measure =
SUMX (
    VALUES ( Customers[Customer ID] ),
    SUMX ( VALUES ( 'Calendar'[Month Year] ), [Churned Customer MRR] )
)

If the total values are still incorrect, could you please provide me with a simplified pbix file in order to make troubleshooting and give a suitable solution? Thank you.

Best Regards

Community Support Team _ Rena
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

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

This measure seems to work

New MRR (Ashish) = SUMX('Calendar',[New MRR])

See last row in the table

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ddbaker
Helper I
Helper I

@v-yiruan-msft Thank you for your response.

I tried your measure:

Churned Customer MRR = 
VAR CustomerList =
    VALUES(Customers[Customer ID])
VAR Dates = 
    VALUES('Calendar'[Month Year])
VAR ChurnedMRR =
    SUMX(
        FILTER(
            CustomerList,
            _Measures[MRR (Current)] = 0
        ),
        [MRR (Change)]
    )
RETURN
    SUMX(
        Dates,
        ChurnedMRR
    )

But the totals still don't work:

ddbaker_0-1640629301438.png

Any ideas?

 

Hi @ddbaker ,

Please create a new measure as follows, instead of updating the original measure [Churned Customer MRR]. Later put this new measure in the matrix visual to replace the measure [Churned Customer MRR]...

New measure =
SUMX (
    VALUES ( Customers[Customer ID] ),
    SUMX ( VALUES ( 'Calendar'[Month Year] ), [Churned Customer MRR] )
)

If the total values are still incorrect, could you please provide me with a simplified pbix file in order to make troubleshooting and give a suitable solution? Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@amitchandak I did get some ideas from your logic. I was able to fix the calcs for New, Upgrade, and Downgrade MRR, but the same logic didn't work for Churned MRR for some reason. Here's the measure I tried:

VAR t1 =
    SUMMARIZE(
        Subscriptions,
        Customers[Customer ID],
        'Calendar'[Month Year]
    )
RETURN
SUMX(
    t1,
    IF(_Measures[MRR (Current)] = 0, [MRR (Change)], 0)
)

This gives me an incorrect monthly result (as opposed to the measure in the original post) and doesn't sum the months. Which is strange because the same logic works for the other MRR measures. Do you have any ideas?

@mahoneypat  Feel free to chime in as well if you have any ideas.

Hi @ddbaker ,

Please try to create another new measure as below base on the original measure [Churned MRR] and put it on the visual to replace the measure [Churned MRR], later check whether it can get the correct total value.

New measure =
SUMX (
    VALUES ( Customers[Customer ID] ),
    SUMX ( VALUES ( 'Calendar'[Month Year] ), [Churned MRR] )
)

In addition, you can refer the method in the following links to resolve it.

Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

Dax for Power BI: Fixing Incorrect Measure Totals

Best Regards

Community Support Team _ Rena
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.