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
computermike
Helper I
Helper I

Order by with selectcolumns. Using in SSAS Tabular

I have a selectcolumns statement that works well in SSAS Tabular as "Detail Rows Expresion".  I have two issues.

1.) If I put my expression in DAX Studio it doesn't run, so its hard to develope.

2.) I need to add an Order by to my selectColumns, to make my drilltrhough better for my end users.

 

Here is my DAX used in my Tabular project below.  Any help appreciated with either issue.

 

Thanks, Mike

 

SelectColumns(
'fSales',
"Document No", Related(dInvoice[InvDocNum]),
"Line No", Related(dInvoice[DocLineNum]),
"Sub Line No", Related(dInvoice[DocLineSubNum]),
"Order date",Related(dDate[Date]),
"Sales", [SalesAmt],
"Accruals", [AccrualAmt],
"CrM", [CrMemoAmt],
"Other", [OtherAmt],
"Total",[Amount]
)

 

 

1 ACCEPTED SOLUTION

I posted my question over at the SSAS forum and got some help from Darren Gosbell.  If you see anything by him read, he's great.  He suggested I wrap in TOPN.  I havn't had time to implement yet except in SSMS as a query.  I did notice the sorting is not guarentteed according to the documentation.  Here my link to the SSAS thread.

 

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6778d306-53f7-4e3a-b890-38bcf58d89f2/2017-d...

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@computermike,


It is not supported to drill through from a measure in Power BI Desktop. In Power BI Desktop, drillthrough is based on dimension fields, for more details, please review this article.

In addition, after you import required tables from SSAS to Power BI Desktop, create a new table using above DAX , the DAX should run as expected.

1.JPG

Regards,
Lydia

I am creating reports in Excel first, so its the drill through in Excel that I am trying to get to work.  I posted my issue here because I was under the impression this is the best place for DAX questions.

 

I am going to try creating a caculate table in SSAS or adding the related feilds to my fact table or determining what is causing the sort.  I may also add a column for sorting to my fact table.

 

yes, this work in SSMS and dax studio, but returns an error in SSAS Tabular.  If I remove the order by clause it works in SSAS Tabular.

 

evaluate
SELECTCOLUMNS (
'fSales',
"Document No", RELATED ( dInvoice[InvDocNum] ),
"Line No", RELATED ( dInvoice[DocLineNum] ),
"Sub Line No", RELATED ( dInvoice[DocLineSubNum] ),
"Order date", RELATED ( dDate[Date] ),
"Sales", [SalesAmt],
"Accruals", [AccrualAmt],
"CrM", [CrMemoAmt],
"Other", [OtherAmt],
"Total", [Amount]
) order by [Line No] desc
Anonymous
Not applicable

@computermike,

As the question is more related to SSAS, I would recommend you post the question in the SSAS forum at https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlanalysisservices  . It is appropriate and more experts will assist you.



Regards,
Lydia

I posted my question over at the SSAS forum and got some help from Darren Gosbell.  If you see anything by him read, he's great.  He suggested I wrap in TOPN.  I havn't had time to implement yet except in SSMS as a query.  I did notice the sorting is not guarentteed according to the documentation.  Here my link to the SSAS thread.

 

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6778d306-53f7-4e3a-b890-38bcf58d89f2/2017-d...

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors