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
Anonymous
Not applicable

How to create Additional column with day no by filtering other column

Hi Everyone 

This is my dataset

Capture-1.PNG

 

 

 

 

 

 

 

 

 

I want to create one additional column which lists like day1, day2, day3 

example: If there is Chennai in the city column then it should consider the minimum of date in the date column and starts with day 1, day2, day3 and it should filter by keeping the city as a filter for populating day column.

My result should be

 

Capture-2.PNG

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Check the file:  Download PBIX 

 

Take a look at table 2, it creates a range of date for each row and an index to get the index value for the date range.

 

If you consider it as a solution, please mark as a solution and kudos.

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

14 REPLIES 14
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

I've created this file using Power Query:  Download PBIX 

 

If you consider it as a solution, please mark as a solution and kudos.

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 

It really helped me a lot to learn more about it.

Suppose there are more duplicate date row then it displaying like 1, 2, 3, 4

But I need one day 1 for all the date and attached my example below

Capture-3.PNG

 

Please help me out from this.

 

Hi @Anonymous ,

 

Check it:

Capture.PNG

 

I just sorted the table by date added an Index column, it won't have a duplicated index for the same market/city.

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 

 

If there are 2 dates with the same sate then it should be populated as Day1, not day1, day2(as attached below).

In below attachment, you can see for the city Chennai 2 date are repeated but in day column it should be day 1 not day 1 and 2

 

Capture-3.PNG

@Anonymous ,

 

I thought it was only till column:

 

Capture.PNG

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 

Could you please share the answer for my question

 

Hi @Anonymous 

 

The answer is to create nested groups and index:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sxLyUxU0lFyzkjNy0vMBLKMDPQNjPWNDIBMUwOlWB2sagzhaoxMiFBjjKLGtzQ3CazEEGiVCVSJIQ4lhgglRjiUGMGVGEOUOJYWlxQl5oCVBVem5KVWQk0ygigzMcajzAiuzMgCQ5lvak5SfmlRXipIpTFCpSmuQEANzFgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Market = _t, City = _t, Date = _t, Sales = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Market", type text}, {"City", type text}, {"Date", type date}, {"Sales", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Market", "City"}, {{"Rows", each _, type table [Market=text, City=text, Date=date, Sales=number, Index=number]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn(Table.Group([Rows],
{"Market", "City", "Date", "Sales"},
{
{"Rows", each _, type table
[
Sales=number
]
}
}), "Index", 1,1)),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"Market", "City", "Date", "Rows", "Index"}, {"Market", "City", "Date", "Rows", "Index"}),
#"Expanded Rows" = Table.ExpandTableColumn(#"Expanded Custom", "Rows", {"Sales"}, {"Sales"})
in
#"Expanded Rows"

 

Also, you can download the pbix file.

 

If you consider it as a solution, please mark as a solution and kudos.

Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 

I couldn't find the link to download your pbix file

@Anonymous ,

 

File:  Download PBIX 

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 

Still, I couldn't reflect this logic into my report 

so I have attached my original sample dataset so please clarify by using this

Capture-4.PNG

@Anonymous ,

 

Is it correct to have a day 3 skipping the day 2 on India / Delivery 2 ?

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Yes, correct because day 2 will be 11th April 2020.

Day 1, 2, 3, 4 should calculate based on the first date

Hi @Anonymous ,

 

Check the file:  Download PBIX 

 

Take a look at table 2, it creates a range of date for each row and an index to get the index value for the date range.

 

If you consider it as a solution, please mark as a solution and kudos.

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



parry2k
Super User
Super User

@Anonymous create a rank and a lot more details here.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
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.

Top Kudoed Authors
Users online (17,115)