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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
spartan27244
Resolver I
Resolver I

Calculating Changes between user defined periods

I need to create the rate of change between the periods in a slicer, below is an example visual.

spartan27244_0-1622046277954.png

You can see that the user has selected a range of report periods, and the dates in the grid are for illistrative purposes so you can see that we are not necessarily working with calendar years, but user selected/defined reports periods that are in a table related to the "Date" table which relates to the claims values, see model below.

spartan27244_1-1622046784687.png

 

Note that PMPMMedPlan is itself a measure that is calculated as "PMPMMedPlan = Sum('Med Claims'[MedPlanPaid]) / Sum(PME[MM])"

Considering

 

Plan Paid PMPM Rate Changes

Year

PMPM  

Yr to Yr

2016f

$287.74  

 

2017f

$311.32  

7.5%    

2018f

$348.03  

10.5%  

2019f

$345.07

-0.9%

2020f

$342.47

-0.4%

I need to calculate "Yr to Yr" which is the difference between periods) / value for current period i.e.

For 2020f    ((342.47 - 345.07) / 342.47) = -1.2 / 342.47 = -0.0035039565509388, to be expressed as % = -0.4%

 

2 REPLIES 2
amitchandak
Super User
Super User

@spartan27244 , usually in such cases when do have standard period we use rank on period

 

New column in date table

new column

Period Rank = RANKX(all('Period'),'Period'[year period],,ASC,Dense)

 

measure

This Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])))
Last Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])-1))

Last year same period= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Month] = Max('Date'[Month])))

 

or

 

Last Year Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Period'[Period]=max('Period'[Period]) && 'Period'[Year]=max('Period'[Year])-1))

 

 

new column

Year Rank = RANKX(all('Date'),'Date'[Year Start date],,ASC,Dense)

 

new measures
This Year = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year Rank]=max('Date'[Year Rank])))
Last Year = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year Rank]=max('Date'[Year Rank])-1))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

These are not standard Calendar year periods as indicated in the dates shown for illustrative purposes.  In addition the ReportPeriod table is a customer populationId, a Group Name (Calendar Year, Fiscal Year, Benefit Year, Custom), a period name 2015, 2016, 2017, etc. and a date field MedDate. There is a MedDate for every day within the period so that it redily joins with the model's DATE table. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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