cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Subtracting cells in two rows with condition

Hi PowerBi Pros!

 

I am wondering if something that i would like to achieve is possible, please look at the picture and read description below:

powerBi.JPG

 

I would like to add a column to the right, where if a cell table[ActionType] = "TERMINATING", it calculates a difference between timestamps (timestamp for TERMINATING - timestamp for STARTING in below row). If the result is positive (>0) then store it in a column in a corresponding row (eg next to timestapm for terminating), if result is negative don't store it. And all of that applied to whole table. 

 

I tried conditional column and i guess it cannot be done with this or at least I couldn't make it. 

 

Will be very thankful for responses and tips!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Subtracting cells in two rows with condition

Hi,

 

If someone would look for solution for similar problem to mine, you can check here:

https://stackoverflow.com/questions/56860115/powerbi-subtracting-two-cells-in-different-rows-with-co...

I got help from stack users.

 

Cheers!

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Subtracting cells in two rows with condition

Hi @trololo 

There are many rows with value "TERMINATING" and  "STARTING".

We can't define which row is the following row for "TERMINATING" and  "STARTING".

 

If you data only have two top rows with value "TERMINATING" and  "STARTING", then others would generate from your the calculation, this is impossible to do with Power BI.

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Frequent Visitor

Re: Subtracting cells in two rows with condition

Hi,

 

If someone would look for solution for similar problem to mine, you can check here:

https://stackoverflow.com/questions/56860115/powerbi-subtracting-two-cells-in-different-rows-with-co...

I got help from stack users.

 

Cheers!

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors