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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rich_P
Helper II
Helper II

Define Column Order using SELECTCOLUMNS

I'm using SELECTCOLUMNS to project a subset of fields from my data model onto an Excel worksheet. The example uses the expression below to force the columns to appear in the order I want them displayed.

EVALUATE
SELECTCOLUMNS (
    'GES BB Invoice Data',
    "ESS Key", 'GES BB Invoice Data'[ESS_KEY],
    "Inv #", 'GES BB Invoice Data'[Inv Num],
    "Source", 'GES BB Invoice Data'[Source],
    "Inv Amt Claimed", 'GES BB Invoice Data'[Inv Claimed Amt],
    "Unclaimed Amt", 'GES BB Invoice Data'[UnclaimedDeniedAmt],
    "Reason", 'GES BB Invoice Data'[Reason],
    "Inv Status", 'GES BB Invoice Data'[Inv Status]
)

However, the result appears in a completely random order. 

SELECTCOLUMNS_Img.png

Can anyone explain why? Or how to get the results I need?

 

Thanks,

 

Rich P

 

 

 

 

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Rich_P ,

 

As this casethe ORDER BY clause is part of the EVALUATE statement and the drillthrough expression just accepts a table expression. One possible work around would be to wrap your SELECTCOLUMNS in a TOPN. You could then either set a reasonable limit on the drillthrough to stop people from trying to extract too much data or you could just put a huge number for the "N" amount (eg. 2 billion) so that it just does sorting, but does not realistically limit the rows.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Rich_P ,

 

As this casethe ORDER BY clause is part of the EVALUATE statement and the drillthrough expression just accepts a table expression. One possible work around would be to wrap your SELECTCOLUMNS in a TOPN. You could then either set a reasonable limit on the drillthrough to stop people from trying to extract too much data or you could just put a huge number for the "N" amount (eg. 2 billion) so that it just does sorting, but does not realistically limit the rows.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @Rich_P ,

 

Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.