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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.