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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
UK06B1
Helper II
Helper II

Month On Month mvmt % calculating incorrectly when prior month a negative value

Hello

Can anyone help – using the month on month movement in Power BI I don’t get the desired result in the %s when there is a credit value in the previous month. Example below

The costs increased from a credit of 72k to a credit of 33k in the current month  - there for its an increase in the over all costs of 38k (as shown in the abs calc ), but the % shows a negative 54% - if I were to do in excel I use the formula as shown in the 2nd screen shot – how can I replicate this in the BI calc, I have tried a few ways but am struggling to make it work .

 

Once i get this correct i can then conditional format correctly on the % as currently its not working given the % movment is wrong sign convention. 

 

Thanks

UK06B1_0-1706897330183.pngUK06B1_1-1706897335269.png

 

 

1 ACCEPTED SOLUTION
audreygerred
Super User
Super User

Hi! You can do another measure to account for what you need. I put the following data in a table:

audreygerred_0-1706898865573.png

I then made a measure for CY = 

SUM('Table'[Cost])
 
Then, one for PY =
Cost PY = CALCULATE([Cost CY], SAMEPERIODLASTYEAR('DateTable'[Date]))
 
Then, one for the difference = 
[Cost CY]-[Cost PY]
 
Then one for YoY% (can be done for MoM as well, but I went with YoY since your data referenced CY and PY) = 
Cost CY YoY% =
IF(
    ISFILTERED('Table'[Date]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __PREV_YEAR = CALCULATE([Cost CY], DATEADD('DateTable'[Date], -1, YEAR))
    RETURN
        DIVIDE([Cost CY] - __PREV_YEAR, __PREV_YEAR)
)
 
Then finally - the one that accounts for the negative in PY = 
IF([Cost PY]>0,[Cost CY YoY%],(-1*DIVIDE([Diff],[Cost PY])))
 
And, here are the results:
audreygerred_1-1706899056379.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
UK06B1
Helper II
Helper II

Great thanks alot for your help that works. 

You are very welcome! Happy to help!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





audreygerred
Super User
Super User

Hi! You can do another measure to account for what you need. I put the following data in a table:

audreygerred_0-1706898865573.png

I then made a measure for CY = 

SUM('Table'[Cost])
 
Then, one for PY =
Cost PY = CALCULATE([Cost CY], SAMEPERIODLASTYEAR('DateTable'[Date]))
 
Then, one for the difference = 
[Cost CY]-[Cost PY]
 
Then one for YoY% (can be done for MoM as well, but I went with YoY since your data referenced CY and PY) = 
Cost CY YoY% =
IF(
    ISFILTERED('Table'[Date]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __PREV_YEAR = CALCULATE([Cost CY], DATEADD('DateTable'[Date], -1, YEAR))
    RETURN
        DIVIDE([Cost CY] - __PREV_YEAR, __PREV_YEAR)
)
 
Then finally - the one that accounts for the negative in PY = 
IF([Cost PY]>0,[Cost CY YoY%],(-1*DIVIDE([Diff],[Cost PY])))
 
And, here are the results:
audreygerred_1-1706899056379.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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