Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Brainzoe
New Member

I am working on a Calculated Table to show Milestones over Time

I want to add sorting for the date to make sure it returns the milestone well ordered by date.
This is the Dax I used 
MilestoneTable =
VAR GroupedData =
SUMMARIZE (
'Query3 (3)',
'Query3 (3)'[Product name],
"Milestones",
CONCATENATEX (
'Query3 (3)',
"[" &
"""" & FORMAT('Query3 (3)'[Date], "YYYY-MM-DD") & """," &
"""" & 'Query3 (3)'[Product name] & """," &
"""" & 'Query3 (3)'[Description] & """" &
"]",
","
)
)
RETURN
SELECTCOLUMNS (
ORDER BY( GroupedData, 'Query3 (3)'[Date], ASC ),
"Product name", 'Query3 (3)'[Product name],
"Milestones", IF(COUNTROWS(GroupedData) > 1, "[" & [Milestones] & "]", [Milestones])
)


 

But I keep getting this error:
The syntax for 'ORDER' is incorrect. (DAX(VAR GroupedData = SUMMARIZE ( 'Query3 (3)', 'Query3 (3)'[Product name], "Milestones", CONCATENATEX ( 'Query3 (3)', "[" & """" & FORMAT('Query3 (3)'[Date], "YYYY-MM-DD") & """," & """" & 'Query3 (3)'[Product name] & """," & """" & 'Query3 (3)'[Description] & """" & "]", "," ) )RETURN SELECTCOLUMNS ( ORDER BY( GroupedData, 'Query3 (3)'[Date], ASC ), "Product name", 'Query3 (3)'[Product name], "Milestones", IF(COUNTROWS(GroupedData) > 1, "[" & [Milestones] & "]", [Milestones]) ))).

1 ACCEPTED SOLUTION

Thank you, I figured out that ORDER BY is not a valid expression in calculated table. So I sorted the HTML content viewer using java script. It's fine now.

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

the correct syntax is 

 

RETURN <something something>

ORDER BY <column>

Thank you, I figured out that ORDER BY is not a valid expression in calculated table. So I sorted the HTML content viewer using java script. It's fine now.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.