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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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!

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.