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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Using DAX How to get next value of a row in a column to new column

Hi All,

 

Can you please help me to create Next State change Date and Next Work Item Id   columns for the below sample data please.

Work Item IdStateState Change DateNext State Change DateNext Work Item Id
1365418New4/30/2022 3:585/3/2022 3:201365418
1365418In Refinement5/3/2022 3:205/3/2022 3:201365418
1365418In Refinement5/3/2022 3:205/25/2022 5:581365418
1365418Ready for Dev5/25/2022 5:586/3/2022 4:151365418
1365418Active6/3/2022 4:156/29/2022 8:261365418
1365418Testing6/29/2022 8:267/6/2022 9:391365420
1365420Active7/6/2022 9:397/20/2022 7:581365420
1365420Testing7/20/2022 7:588/10/2022 3:291365420
1365420Accepted8/10/2022 3:298/10/2022 3:291365420
1365420Accepted8/10/2022 3:298/18/2022 8:371365420
1365420Closed8/18/2022 8:374/30/2022 3:581365423

@jdbuchanan71 

Thanks,

 

4 REPLIES 4
Anonymous
Not applicable

I'm still looking for help on this. Please help

Anonymous
Not applicable

Hi @Anonymous,

You can try to use the following measure formulas if they suitable for your requirement:

Next State Change Date = 
VAR currDate =
    MAX ( T1[State Change Date] )
RETURN
    CALCULATE (
        MIN ( T1[State Change Date] ),
        FILTER ( ALLSELECTED ( T1 ), [State Change Date] > currDate )
    )

Next Work Item Id = 
VAR currDate =
    MAX ( T1[State Change Date] )
VAR nextDate =
    CALCULATE (
        MIN ( T1[State Change Date] ),
        FILTER ( ALLSELECTED ( T1 ), [State Change Date] > currDate )
    )
RETURN
    MINX (
        FILTER ( ALLSELECTED ( T1 ), [State Change Date] = nextDate ),
        [Work Item Id]
    )

Regards,
Xiaoxin Sheng

Anonymous
Not applicable

Hi @Anonymous , 
The logic which was shared is giving me no values , may be something is missing and I am trying to investigate . 

As the grouping is at the "work item id " for every workitem id it should calculate "next state change date"  and "next work item id".
The above sample is exaclty i have and I have to showcase these columns additionaly for me to calcualate the Aging of days foe each state. Thanks

Anonymous
Not applicable

Hi @Anonymous ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.