Forum Discussion
DAX: Sorting output
Hey Heinrich,
Looking at your DAX query, there are a few issues with the ORDER BY implementation that need to be addressed:
Issues Identified:
- Incorrect column reference syntax - You're using "[SBC]" but it should reference the actual column name
- ORDER BY placement - The syntax structure needs adjustment
- Missing sort direction - DAX requires explicit ASC/DESC specification
Solution Steps:
Step 1: Fix Column Reference
- Remove the brackets and quotes around the column name
- Use the actual column name from your SELECTCOLUMNS: SBC
Step 2: Correct ORDER BY Syntax Replace your current ORDER BY line with:
ORDER BY [SBC] ASC
Step 3: Alternative Approach (Recommended) Since ORDER BY can be problematic in Power Automate context, consider sorting within the TOPN function instead:
EVALUATE
SELECTCOLUMNS(
__DS0PrimaryWindowed,
"SBC", 'CQD'[PSTN Trunk FQDN],
"Ctry/Org", 'SBC - Information'[Country / Organisation],
"Stage", 'SBC - Information'[Stage],
"NER", [SumPSTN_NER_Good_Percentage],
"TOTAL STREAM", [SumAudio_Good_Stream_Count],
"TOTAL POOR STREAM", [SumAudio_Poor_Stream_Count]
)
ORDER BY [SBC] ASC
Key Points:
- Remove quotes and brackets from column references in ORDER BY
- Always specify sort direction (ASC/DESC)
- Test with the TOPN sorting approach if ORDER BY continues to fail
- Power Automate sometimes has limitations with certain DAX functions
Try the corrected syntax first, and if issues persist, implement the TOPN sorting method as it's more reliable in Power Automate environments.
Fixed? ✓ Mark it • Share it • Help others!
Best Regards,
Jainesh Poojara | Power BI Developer