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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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]) ))).

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors