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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Calculate dynamic percentage change quarter on quarter and year on year

Hello,

 

I am new to Power Bi. I am trying to calculate the percentage change in the number of customers quarter on quarter as well as year on year  based filter applied on two columns- Energy and Supplier. I tried below code but I guess I am going wrong with the Date logic. 

 

change perc = VAR ValueLastYear =
CALCULATE (
SUM ( ElectricityGasCustomerNum[CustomerNumber] ),
FILTER (
ElectricityGasCustomerNum,
ElectricityGasCustomerNum[Date]
= ( EARLIER ( ElectricityGasCustomerNum[Date] ) - 1 )
&& ElectricityGasCustomerNum[Energy] = EARLIER ( ElectricityGasCustomerNum[Energy] )
&& ElectricityGasCustomerNum[Supplier] = EARLIER ( ElectricityGasCustomerNum[Supplier] )
)
)
RETURN
IF (
ISBLANK ( ValueLastYear ),
0,
( ElectricityGasCustomerNum[CustomerNumber] - ValueLastYear )
/ ValueLastYear
)

 

 

DateEnergySupplierCustomerNumber%Change
01/01/2009ElectricityA40000 
01/04/2009ElectricityA190000 
01/07/2009ElectricityA260000 
01/10/2009ElectricityA320000 
01/01/2010ElectricityA370000 
01/04/2010ElectricityA410000 
01/07/2010ElectricityA400000 
01/10/2010ElectricityA450000 
01/01/2009ElectricityB25000 
01/04/2009ElectricityB140000 
01/07/2009ElectricityB100000 
01/10/2009ElectricityB200000 
01/01/2010ElectricityB310000 
01/04/2010ElectricityB280000 
01/07/2010ElectricityB350000 
01/10/2010ElectricityB390000 
01/01/2009GasA30000 
01/04/2009GasA90000 
01/07/2009GasA60000 
01/10/2009GasA30000 
01/01/2010GasA290000 
01/04/2010GasA320000 
01/07/2010GasA390000 
01/10/2010GasA370000 

 

Any help would be greatly appreciated.

 

Thanks!

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Check this file:  Download PBIX 

The key point is to have a date calendar, so you can use the data intel functions.

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

2 REPLIES 2
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Check this file:  Download PBIX 

The key point is to have a date calendar, so you can use the data intel functions.

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 ,

 

Thank you for your solution. It worked. I am building a dashboard for this type of data. It would be great if you could suggest what all insights I can show may be as a summary using the charts of power bi.

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.