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

Make a percentage change formula

I have a long list with multiple entries per month.  I want to know how to write a formula that would show the percentage change per month of the Impressions column.

 

Thank you in advance.

 

DouglasWatkins_1-1669662792873.png

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @DouglasWatkins ,

 

Here are the steps you can follow:

1. Create measure.

 

Measure =
var _startdate=
DATE(YEAR(MAX('Table'[Date])),MONTH(MAX('Table'[Date])),1)
var _enddate=
EOMONTH(_startdate,0)
var _laststartdate=
DATE(YEAR(MAX('Table'[Date])),MONTH(MAX('Table'[Date]))-1,1)
var _lastenddate=
EOMONTH(_laststartdate,0)
var _thissum=
SUMX(FILTER(ALL('Table'),'Table'[Date]>=_startdate&&'Table'[Date]<=_enddate),[Impressions])
var _lastsum=
SUMX(FILTER(ALL('Table'),'Table'[Date]>=_laststartdate&&'Table'[Date]<=_lastenddate),[Impressions])
return
DIVIDE( _thissum - _lastsum,_thissum)

 

2. Result:

vyangliumsft_0-1669688365287.png

 

 

Best Regards,

Liu Yang

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-yangliu-msft
Community Support
Community Support

Hi  @DouglasWatkins ,

 

Here are the steps you can follow:

1. Create measure.

 

Measure =
var _startdate=
DATE(YEAR(MAX('Table'[Date])),MONTH(MAX('Table'[Date])),1)
var _enddate=
EOMONTH(_startdate,0)
var _laststartdate=
DATE(YEAR(MAX('Table'[Date])),MONTH(MAX('Table'[Date]))-1,1)
var _lastenddate=
EOMONTH(_laststartdate,0)
var _thissum=
SUMX(FILTER(ALL('Table'),'Table'[Date]>=_startdate&&'Table'[Date]<=_enddate),[Impressions])
var _lastsum=
SUMX(FILTER(ALL('Table'),'Table'[Date]>=_laststartdate&&'Table'[Date]<=_lastenddate),[Impressions])
return
DIVIDE( _thissum - _lastsum,_thissum)

 

2. Result:

vyangliumsft_0-1669688365287.png

 

 

Best Regards,

Liu Yang

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

FreemanZ
Super User
Super User

seems you are expecting a measure. But measures depend on context, how would you like to present your data? A table visual? What field will you pull to the axis? you would depict it with excel table. 

I will show it in a bar or line chart.  I probably need to create a column that sums the Impressions by month.  Then I would like to use that column to create a column or measure which I can use with a connected date table to create a bar/line chart.

indeed there are multiple ways, it would be super easier if you have a Date table. 

Create three measures:
ImpressionSum = SUM(TableName[Impressions])
ImpressionSumPM =
CALCULATE([ImpressionSum], DATEADD('Date'[Date], -1, MONTH))
ImpressionVariance= FORMAT( DIVIDE(ImpressionSum-ImpressionSumPM, ImpressionSumPM), "00.0%")
 
Plot the chart visual with measure [ImpressionVariace] and use Date with monthly granularity on the axis. 

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.