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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Sekharnaga
Frequent Visitor

Difference between current month and previous month Percentage

I have a monthwise Percentage data, when i filter month on the top, it is required to show the difference between current month and previous month Percentage. Please help with DAX function

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Sekharnaga ,

 

Based on your description, I created an example using this sample data:

vkaiyuemsft_0-1725871353931.png

 

Create measure, calculate the percentage for the current month of the current year.

MEASURE = 
VAR _month =
    SELECTEDVALUE ( 'financials'[Month Number] )
VAR _year =
    SELECTEDVALUE ( financials[Year] )
VAR _sum1 =
    CALCULATE (
        SUM ( financials[ Sales] ),
        'financials'[Month Number] = _month
            && 'financials'[Year] = _year
    )
VAR _sum2 =
    CALCULATE (
        SUM ( financials[Gross Sales] ),
        'financials'[Month Number] = _month
            && 'financials'[Year] = _year
    )
RETURN
    DIVIDE ( _sum1, _sum2 )


Create a measure, get the percent for the previous month, and calculate the difference.

Measure2 = 
VAR _month =
    SELECTEDVALUE ( 'financials'[Month Number] )
VAR _year =
    SELECTEDVALUE ( financials[Year] )
VAR _sum1 =
    CALCULATE (
        SUM ( financials[ Sales] ),
        'financials'[Month Number] = _month - 1
            && 'financials'[Year] = _year
    )
VAR _sum2 =
    CALCULATE (
        SUM ( financials[Gross Sales] ),
        'financials'[Month Number] = _month - 1
            && 'financials'[Year] = _year
    )
VAR _pre =
    DIVIDE ( _sum1, _sum2 )
RETURN
    IF ( _pre = BLANK (), BLANK (), [MEASURE] - _pre )

vkaiyuemsft_1-1725871402752.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any 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
Anonymous
Not applicable

Hi @Sekharnaga ,

 

Based on your description, I created an example using this sample data:

vkaiyuemsft_0-1725871353931.png

 

Create measure, calculate the percentage for the current month of the current year.

MEASURE = 
VAR _month =
    SELECTEDVALUE ( 'financials'[Month Number] )
VAR _year =
    SELECTEDVALUE ( financials[Year] )
VAR _sum1 =
    CALCULATE (
        SUM ( financials[ Sales] ),
        'financials'[Month Number] = _month
            && 'financials'[Year] = _year
    )
VAR _sum2 =
    CALCULATE (
        SUM ( financials[Gross Sales] ),
        'financials'[Month Number] = _month
            && 'financials'[Year] = _year
    )
RETURN
    DIVIDE ( _sum1, _sum2 )


Create a measure, get the percent for the previous month, and calculate the difference.

Measure2 = 
VAR _month =
    SELECTEDVALUE ( 'financials'[Month Number] )
VAR _year =
    SELECTEDVALUE ( financials[Year] )
VAR _sum1 =
    CALCULATE (
        SUM ( financials[ Sales] ),
        'financials'[Month Number] = _month - 1
            && 'financials'[Year] = _year
    )
VAR _sum2 =
    CALCULATE (
        SUM ( financials[Gross Sales] ),
        'financials'[Month Number] = _month - 1
            && 'financials'[Year] = _year
    )
VAR _pre =
    DIVIDE ( _sum1, _sum2 )
RETURN
    IF ( _pre = BLANK (), BLANK (), [MEASURE] - _pre )

vkaiyuemsft_1-1725871402752.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

 

Sekharnaga
Frequent Visitor

Hi, I already have created meassure for Percentage. Now i want one more table to show the differnce between previous month and current month. 

 

Sekharnaga_0-1725527877081.png

 

Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Jihwan_Kim_1-1725510641279.png

 

Jihwan_Kim_0-1725510529557.png

 

Sales ratio: = 
VAR _currentyear =
    MAX ( 'calendar'[Year] )
VAR _salesyearly =
    CALCULATE (
        SUM ( sales[sales] ),
        FILTER (
            ALL ( 'calendar'[Year-Month], 'calendar'[Year-Month sort], 'calendar'[Year] ),
            'calendar'[Year] = _currentyear
        )
    )
VAR _sales =
    SUM ( sales[sales] )
RETURN
    DIVIDE ( _sales, _salesyearly )

 

 

OFFSET function (DAX) - DAX | Microsoft Learn

 

Previous month sales ratio: = 
CALCULATE (
    [Sales ratio:],
    OFFSET (
        -1,
        ALL ( 'calendar'[Year-Month], 'calendar'[Year-Month sort] ),
        ORDERBY ( 'calendar'[Year-Month sort], ASC )
    )
)

 

 

Difference: = 
IF (
    [Previous month sales ratio:],
    [Sales ratio:] - [Previous month sales ratio:]
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
ahadkarimi
Solution Specialist
Solution Specialist

Hi @Sekharnaga, give this a try, and if you encounter any issues, let me know.
Replace "Table" with the name of your table and "DateColumn" with the name of your column.

Difference_Current_Prev_Month = 
VAR CurrentMonthPercentage = SELECTEDVALUE(Table[Percentage])
VAR PreviousMonthPercentage = 
    CALCULATE(
        SELECTEDVALUE(Table[Percentage]),
        PREVIOUSMONTH(Table[DateColumn])
    )
RETURN
    CurrentMonthPercentage - PreviousMonthPercentage

 

Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Specialist!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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