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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dimuch
Frequent Visitor

I need to know count of days between Status changing

Hi All,
I need to know count of days between Status changing.

Capture.PNG

For example
Asset with InvOrg 20451S was
377 days on Storage, then 4 days in Transit, then 17 days in Production, then 13 days on Storage, then 387 days in Production to now.
So I need to know how to calculate it.
Thanks.

4 REPLIES 4
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @dimuch,

I try to reproduce your scenario and get expected result. I create the following sample table.

1.PNG

Right click the table->Edit Quey, please add an index column to identify each row.

2.PNG

Create a calculated column to get the previous row status.

Previous status = IF(Test1[Index]=1,Test1[Status],LOOKUPVALUE(Test1[Status],Test1[Index],Test1[Index]-1))

3.png

Finally, create a new table to get the expected result. Please click the "New Table" under modeling on Home page.

5.PNG

Thanks,
Angelia



HI,
I used your formula. But, it display incorrect Previous statusCapture1.PNG

Hi @dimuch,

Your resource table is same with the table given above? And do you add a index column, why there is blank in your result. I guess the table you given is not the resouce table. Please check carefully, I create the sample table based on your table, but it's not same with your table. 

Best Regards,
Angelia

Greg_Deckler
Super User
Super User

What does your source data look like? Can you post it in a table (not an image) so that we can mock it up?



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.