Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello!
I have a DAX code allowing me to output a table, which I use then in other systems (PowerAutomate) to communicate via mail to users.
It needs to be ranked, however it is super annoying to see the [Rank] column in the final mail table; and I had to use a [Rank] column, as the standard date column I would simply use needs to be formatted for later consumption (otherwise it gets the universal time format in Powerautomate and it becomes difficult to read).
Anyway, question is: is there a way to pre-order the final table, so that I can eliminate the column [Rank] from it but still have it ordered by [Unit] - which I want to keep - and [Rank]? I have been playing with it way too long, hence coming to the experts 🙂
I am leaving the whole code for completeness, I have highlighted the [Rank] parts in red, and the final table I am talking about is the one after the RETURN statement.
Thank you!
Kind regards
Valeria
Solved! Go to Solution.
The argument for ORDER BY doesn't need to be in the table you're ordering, it can be a measure or an expression. Try
ORDER BY [Unit], DATEVALUE( [Prod. Date] ASC
The argument for ORDER BY doesn't need to be in the table you're ordering, it can be a measure or an expression. Try
ORDER BY [Unit], DATEVALUE( [Prod. Date] ASC
@johnt75 I love this solution! I don't know how I missed that you could use measures or expressions in ORDER BY. Thank you!!!!!
Instead of using ORDER BY use TOPN with a very large number. TOPN returns the top N rows sorted by the specified columns.
RETURN
SELECTCOLUMNS(
TOPN( 100000, -- large number to include all rows
RankedTable,
[Unit], ASC, [Rank], ASC ),
[Unit],
[Change Type],
[Delta Old/New],
[Reprint?],
[Prod. Date],
[PO],
[Change Detail],
[Old Value],
[Old Date],
[New Value],
[GMID],
[Product],
[Batch],
[Model],
[Send to SAP Date/Time]
)
I hope this helps, please give kudos and mark as solved if it does, thanks!
@wardy912 This is another interesting solution! I learned something today :-). Thank you!!!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 12 | |
| 10 | |
| 8 |