Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi Everyone
This is my dataset
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
Solved! Go to 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
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
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
Please help me out from this.
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
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
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
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
@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.