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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

difference between rows within a category

Hello, I am using power querry for data processing and I need help getting the difference between rows. 

I have a table that has the following rows and columns:

Country     Code    Region     Stage                           Start_Date                   Index 

China 1Asia111/4/2019 0
China 1Asia212/4/20191
China1Asia310/24/2020 2
Spain2Asi112/24/20203

 

 

I want to add an end date column for each phase, and for phase 3 i want it to have a date of 12/31/2025. I want to eventually join this to a table of all of the months so that I can count how many employees i need each month. 

Can you help me do this using power query within excel?

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Please follow Greg_Deckler and edhans 's suggestions, provide more details.

As i assumed, if "Stage" from your table refers to "phase" in your statement,

and your requirement is like stage1,2,3 have different end dates,

then you could add conditional column like the following:

Capture1.JPG

As for another requirement: "count how many employees i need each month", 

Do you mean to count the employees who are between start date and end data?

 

Best Regards

Maggie

sss

edhans
Super User
Super User

Hi @Anonymous 

 

Can you be a bit more specific? For example:

  1. You want Phase 3 to have an end date of 12/25/2025. What is a "phase?" You have no "Phase" columns.
  2. Where are you getting 12/25/2025? How is that being calculated?

I attaching more data, please see the guildlines for sample data below. The table you provided was not easy to get into a file.

How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum

 

@Greg_Deckler - I'm not Imke (not even close!), but there are a lot of us here to help on Power Query too. 😊



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Understood @edhans. I'll have to add you to my macro invoking @ImkeF ! @ImkeF and I go way way back, I've been giving shout outs to her on Power Query questions for years! 🙂


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@ImkeF


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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 Solution Authors