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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

How to divide current year value by previous year value

Dear power BI community, I would really appreciate If you could help me out with the following issue

 

I have a table which contains the following variable.

 

Company       Year    Quarter     value 1  value 2 

Company 1     2010    Q1            123         123

Company 1     2010    Q2            123         123

Company 1     2010    Q3            123         123

Company 1     2010    Q4            123         123

Company 1     2011    Q1            123         123

.

.

so on 

 

Now I want to create a new column (using custom column) with formula:

                        = current year/ previous year

i.e. for 2011 Q1 it will be:

                        = (2011 Q1 value1)/ (2010 Q1 value1)

 

Any ideas, how to do this on M language?

 

Any help will be much appreciated.

Thanks

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
Microsoft Employee

  1. Create a column with previous year (year - 1)
  2. Do a self join (merge) on Year and Quarter with Previous Year and Quarter
  3. Expand joined column selecting all "value" like fields
  4. Add new columns for each "value" field with value / Joined.value

View solution in original post

1 REPLY 1
artemus
Microsoft Employee
Microsoft Employee

  1. Create a column with previous year (year - 1)
  2. Do a self join (merge) on Year and Quarter with Previous Year and Quarter
  3. Expand joined column selecting all "value" like fields
  4. Add new columns for each "value" field with value / Joined.value

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors