Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I have seen similar posts to this but wanted to throw a question out there--I have created a running totals column in the power query, which I would like to generate based on the date in ascending order. My table is not automatically sorted by date, so I added a step in the power query to "sort" prior to adding an index column. It seems to work initially, but when I apply the steps, the index follows the natural order of the observations, rather than sorting by date.
Is there a quick workaround to this?
Essentially, to ensure that an index column follows a sort filter that I have applied?
I have attached a screenshot of my columns for reference--the running total is currently not being calculated in chronological order. photo
Hi @lenafherold ,
Did you get a chance to see whether either of the answers to your question were helpful at all?
If an answer helped you solve your issue, please mark it as the solution.
If you're still having issues, please explain in more detail where the answers provided are missing the point and we can revisit to get this sorted for you.
Pete
Proud to be a Datanaut!
Hi @lenafherold ,
I think you want an index column grouped by the date column.
Here's my solution.
1.Right-click on the date column and select Group By.
2.Select All Rows.
3.Add an index column.
4.Expand the column.
You can check more details from the attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Excellent, i was looking for this very solution. Thanks!
@Anonymous
Hi both.
I've removed the solution applied to this post as it doesn't appear to actually provide a solution to OP's question. Happy to discuss in more detail if required.
Pete
Proud to be a Datanaut!
Hi @lenafherold ,
It looks from your screenshot that it's working fine.
Power Query sometimes jumbles up the rows on certain operations e.g. merges etc., but it has also jumbled the index accordingly, so your cumulative sums are still calculating in the right order.
In the instance that sorted dates all have equal values (as yours mostly do), I believe the sort then reverts to the left-most column order, then next one etc. As such, when you apply this to the model, and the AS engine swaps all your columns around, then you sort again on your date column, the sort criteria has changed and therefore so does your sort order. In this instance, you should sort on the index column in the data model to get back to exactly the same order the rows were in when you applied the index in PQ.
Not sure if there was another issue that I missed?
Pete
Proud to be a Datanaut!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
8 | |
8 | |
7 |
User | Count |
---|---|
17 | |
13 | |
7 | |
6 | |
6 |