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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Getting next date from dynamic indexing

Hello,

 

In the below images, i'm trying to extract the datediff between some dates and then get a rolling sum of it, for every id. 

SoiledisK_0-1640354851397.png

In the left table we have a date column sorted, which corresponds to the status column (2nd column). In the right table we have the same table filtered for specific status. Then I have created a dynamic measure called row_num, which as you see, is a dynamically adjusted to provide the index. 

My logic is to create a date_out calculated column, where it contains the value of date_in but row_num = row_num + 1. Then get the datediff of date_in, date_out of each row and finally get a rolling sum of datediff. 

 
RowNum = 
COUNTROWS (
    FILTER (
        ALLSELECTED ( wo_dates ),
        COUNTROWS (
            FILTER (
                wo_dates,
                wo_dates[date_in] <= EARLIER ( wo_dates[date_in] )
                && wo_dates[dot_workorderid] = EARLIER (wo_dates[dot_workorderid]  )
            )
        )
    )
)

This is the code for Row_Num. It creates a circular dependency. 
Any suggestions are welcome

 

5 REPLIES 5
Anonymous
Not applicable

Hi thanks for your replies. 

I'm looking for a solution that will give me the specific result

SoiledisK_1-1641208167316.png

 

The diff_in_minutes created column is basically the difference from the previous date entry, which is the metric im looking for. Consider that the dataset contains many id's.

 

I've attached a small sample that contains the data above without the last column.

dot_workorderiddate_inRowNum
id_122/12/2021 13:531
id_122/12/2021 13:452
id_122/12/2021 13:423
id_122/12/2021 13:424
id_122/12/2021 13:425
id_122/12/2021 13:406
id_12/12/2021 18:127
id_12/12/2021 10:278
id_12/12/2021 9:109
id_12/12/2021 9:1010
id_12/12/2021 9:1011
id_130/11/2021 15:4912
id_130/11/2021 15:4913
id_130/11/2021 15:4914
id_130/11/2021 15:4915
id_125/11/2021 22:1816
id_125/11/2021 20:0517
id_125/11/2021 20:0518
id_125/11/2021 19:4619
id_125/11/2021 19:4520
id_125/11/2021 19:4521
id_210/9/2021 16:151
id_226/8/2021 4:242
id_210/8/2021 17:133
id_210/8/2021 17:124
id_210/8/2021 17:115
id_210/8/2021 11:046
id_28/8/2021 15:157
id_28/8/2021 15:158
id_25/8/2021 16:509
id_25/8/2021 14:5710
wdx223_Daniel
Super User
Super User

date_out=
MAXX (
    FILTER (
        ALLSELECTED ( wo_dates ),
        COUNTROWS (
            FILTER (
                wo_dates,
                wo_dates[date_in] < EARLIER ( wo_dates[date_in] )
                && wo_dates[dot_workorderid] = EARLIER (wo_dates[dot_workorderid]  )
            )
        )
    ),wo_dates[date_in]
)
Anonymous
Not applicable

Thank you for the reply. The specific formula returns the max date.

v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

Could you please consider sharing more details about it and posting expected result so it is clear on what needs to be implemented?  And It would be great if there is a sample file without any sesentive information here.
It makes it easier to give you a solution.



Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous ,Can you share sample data and sample output in table format?

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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