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 September 15. Request your voucher.

Reply
eliasayyy
Memorable Member
Memorable Member

create a new column date of next tax and list from date to the new column date

hello guys if title is confusing,
i have tax rate that changes not necessarly once a month or anything but it changes and i want to create a list of date from date to the next date so here is the table example:

tax_value            date
0.258/1/2022
0.310/1/2022
0.339/1/2022
0.2511/1/2022
0.2811/13/2022
0.3312/1/2022

 


my desire result in mquery is to get the date of the next date in the period and the latest date is till today

so in this example i want to create a new column where the result will be :

tax_value               date                   Expected Result 
0.258/1/20229/1/2022
0.310/1/202211/1/2022
0.339/1/202210/1/2022
0.2511/1/202211/13/2022
0.2811/13/202212/1/2022
0.3312/1/2022date of today

 

is this possible and acheivable through power query?
@Anonymous you helped me with something close to this so any idea?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @eliasayyy , in order to achieve it through power query please follow the steps below.

 

First you have to sort column of date ascending if you want them in order now follow up:

 

1) Add a new index column 

 

2) Add a new column named test for example with the below formula:

Try [date] {[Index] + 1} otherwise null

 

3) add a new column named End Date with the below formula

If [test] is null then Datetime.LocalNow() else Date.AddDays([test],-1)

4) change type to date

 

Given you mentioned you want to create a list from start date to end date follow the rest:

 

5) add a new column with the formula

{Number.From([date])..Number.From([End Date])

 

6) on the created column, click on the column and press expand to new rows

 

7) change type to date 

 

8(optional)) delete old date, ,test,end date, index and you're left with tax value and the  new Date column

 

If i solved your problem, kindly give a thumbs up and mark as solved

 

 

 

 

View solution in original post

5 REPLIES 5
eliasayyy
Memorable Member
Memorable Member

@FreemanZ @tamerj1 thank you for your replies but i woud like to achieve it through power query

Anonymous
Not applicable

Hello @eliasayyy , in order to achieve it through power query please follow the steps below.

 

First you have to sort column of date ascending if you want them in order now follow up:

 

1) Add a new index column 

 

2) Add a new column named test for example with the below formula:

Try [date] {[Index] + 1} otherwise null

 

3) add a new column named End Date with the below formula

If [test] is null then Datetime.LocalNow() else Date.AddDays([test],-1)

4) change type to date

 

Given you mentioned you want to create a list from start date to end date follow the rest:

 

5) add a new column with the formula

{Number.From([date])..Number.From([End Date])

 

6) on the created column, click on the column and press expand to new rows

 

7) change type to date 

 

8(optional)) delete old date, ,test,end date, index and you're left with tax value and the  new Date column

 

If i solved your problem, kindly give a thumbs up and mark as solved

 

 

 

 

This works perfrctly thank you very much

tamerj1
Super User
Super User

Hi @eliasayyy 
Please refer to the attached sample file with the solution

1.png

Expected Result = 
VAR CurrentDate = 'Table'[Date]
VAR TableAfter =
    FILTER ( 'Table', 'Table'[Date] > CurrentDate )
VAR NextDate =
    COALESCE ( MINX ( TableAfter, 'Table'[Date] ), TODAY () )
RETURN
    NextDate
FreemanZ
Super User
Super User

hi @eliasayyy 

If you also consider DAX, this shall work:
Result =
MINX(
    FILTER(
        TableName,
        TableName[date]>EARLIER(TableName[date]),
    TableName[date]
)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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