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
lnschne2
Frequent Visitor

How to calculate percent change from month to month

Hello, I am new to Power BI.  I am trying to calculate a month to month percent change.  See the screenshot of the data below.  

 

This is a preview of what the data looks like 

lnschne2_0-1675265826103.png

 

I'm trying to get the difference between say Jan. 2021 (273) and Jan 2022 (248).  

lnschne2_1-1675265910353.png

 

First, I calculated the total admitted 

TotalAdmitted = CALCULATE(Sum(MarCom_Geomarket[Admitted]))
 
Second, I tried to calculate the total admitted last month or last year to get the month over month difference and no data was generated. 
 
MoM Diff =
VAR CURRENTVAL = [TotalAdmitted]
VAR PREVVAL =
    CALCULATE(
        [TotalAdmitted],
        PREVIOUSMONTH('MarCom_Geomarket'[ApplicationSubmittedDate])
    )
RETURN
   IF(
       [TotalAdmitted] <> BLANK(),
        DIVIDE(CURRENTVAL - PREVVAL, PREVVAL)
    )
 
I also tried using DAX using the SAMEPERIODLASTYEAR and PARARRELPERIOD
 
Total Admitted LY = CALCULATE(SUM(MarCom_Geomarket[Admitted]), SAMEPERIODLASTYEAR(MarCom_Geomarket[ApplicationSubmittedDate])
 
Total Admitted LM = CALCULATE(SUM(MarCom_Geomarket[Admitted]), PARALLELPERIOD(MarCom_Geomarket[ApplicationSubmittedDate],-1,MONTH))
 
Nothing comes up when I add the field to the table 
lnschne2_2-1675266406050.png

 

Anyone have know what might be going wrong or what should be tried? 

 

Thanks so much for your help! 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@lnschne2 
First you need a date calendar.
Then

 Last Month admitted = 
CALCULATE(SUM(Table[Admitted]),DATESBETWEEN(date_dim[Date],DATE(YEAR(TODAY()),MONTH(TODAY())-1,01),DATE(YEAR(TODAY()),MONTH(TODAY()),01)-1))

Last Year Admitted = 
Last Year Admitted = CALCULATE(SUM(Table[Admitted]),date_dim[Year]=YEAR(TODAY())-1)




View solution in original post

1 REPLY 1
Anonymous
Not applicable

@lnschne2 
First you need a date calendar.
Then

 Last Month admitted = 
CALCULATE(SUM(Table[Admitted]),DATESBETWEEN(date_dim[Date],DATE(YEAR(TODAY()),MONTH(TODAY())-1,01),DATE(YEAR(TODAY()),MONTH(TODAY()),01)-1))

Last Year Admitted = 
Last Year Admitted = CALCULATE(SUM(Table[Admitted]),date_dim[Year]=YEAR(TODAY())-1)




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