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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
jay_patel
Helper IV
Helper IV

How to get the next value of another column using dax

Hii All

 

here I have a 'dataset' having column "From Date" but I want another column i.e, "To date" and it should have the next row value of "From Date"

 

For example I have From-Date

From date
12-11-2019
14-11-2019
17-11-2019
22-11-2019
28-11-2019
30-11-2019
12-01-2020
15-02-2020
24-02-2020

 

 

Expected Result

From date  To date
12-11-2019   14-11-2019
14-11-2019   17-11-2019
17-11-2019   22-11-2019
22-11-2019   28-11-2019
28-11-2019   30-11-2019
30-11-2019   12-01-2020
12-01-2020   15-02-2020
15-02-2020   24-02-2020
24-02-2020   31-12-2020 

 

and the last value of  "To Date" must have 'last date of the year'.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jay_patel ,

 

Based on your description, you can do some steps as follows.

1. create an indecx column in Power Query.

v-yuaj-msft_0-1616725662748.png

2. create a column.

Column =
VAR x1 =
CALCULATE ( MAX ( 'Test'[Index] ), ALL () )
RETURN
IF (
[Index] = x1,
DATE ( YEAR ( MAXX ( FILTER ( ALL ( Test ), [Index] = x1 ), [FromDate] ) ), 12, 31 ),
MAXX ( FILTER ( ALL ( Test ), [Index] = EARLIER ( [Index] ) + 1 ), [FromDate] )
)

Result:

v-yuaj-msft_1-1616725679882.png

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @jay_patel ,

 

Based on your description, you can do some steps as follows.

1. create an indecx column in Power Query.

v-yuaj-msft_0-1616725662748.png

2. create a column.

Column =
VAR x1 =
CALCULATE ( MAX ( 'Test'[Index] ), ALL () )
RETURN
IF (
[Index] = x1,
DATE ( YEAR ( MAXX ( FILTER ( ALL ( Test ), [Index] = x1 ), [FromDate] ) ), 12, 31 ),
MAXX ( FILTER ( ALL ( Test ), [Index] = EARLIER ( [Index] ) + 1 ), [FromDate] )
)

Result:

v-yuaj-msft_1-1616725679882.png

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

 

jay_patel
Helper IV
Helper IV

Not getting proper values

Got these values: -

 

FromDate New column
01-02-2019  15-02-2019 00:00
22-01-2020  05-03-2020 00:00
01-02-2019  15-02-2019 00:00
22-01-2020  05-03-2020 00:00
01-02-2019  15-02-2019 00:00
22-01-2020  05-03-2020 00:00
01-02-2019  15-02-2019 00:00
22-01-2020  05-03-2020 00:00
01-02-2019  15-02-2019 00:00
22-01-2020  05-03-2020 00:00

jay_patel
Helper IV
Helper IV

It's not working 

 


FromDate New column
01-02-2019    15-02-2019 00:00
22-01-2020    05-03-2020 00:00
01-02-2019    15-02-2019 00:00
22-01-2020    05-03-2020 00:00
01-02-2019    15-02-2019 00:00
22-01-2020    05-03-2020 00:00
01-02-2019    15-02-2019 00:00
22-01-2020    05-03-2020 00:00
01-02-2019    15-02-2019 00:00
22-01-2020    05-03-2020 00:00

amitchandak
Super User
Super User

@jay_patel , Create a new column like

 

New column =
var _max = minx(filter(Table, [From date] > earlier([From date])),[From date])
return
if(isblank([From date]), date(year([From date]),12,31),_max)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.