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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Employee
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
Employee
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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors