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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
rpereirait
New Member

Help on DAX : SELECTCOLUMNS equivalent to a SQL SUBSELECT?

Hi!

 

I need a help on my DAX Query. Below is my query that I'm using on a Tabular Model to pull Cost Center data. It's working perfectly.

 

EVALUATE (

DISTINCT(

FILTER(
SELECTCOLUMNS(
'dimensionCostCenter',
"Cost Center Code",'dimensionCostCenter'[Cost Center Code],
"Cost Center Name",'dimensionCostCenter'[Cost Center Name],
"Division Name",'dimensionCostCenter'[Division Name],
"Profit Center",'dimensionCostCenter'[Profit Center],
"Cost Center Roll Up L1 Name",'dimensionCostCenter'[Cost Center Roll Up L1 Name])
,NOT ([Cost Center Code]) IN {"211189","211193"})
)

)

 

My challenge is, somehow, to pull just one column, which would be the equivalent of a subselect in SQL.
I applied a pre-filter, to bring only the necessary codes. I'll still need to apply some more filters with the other columns, that's why I'm keeping these columns in the initial query.

But my expectation will be just bring in the "final select" only the Cost Center Code.

 

I appreciate your help!

3 REPLIES 3
Anonymous
Not applicable

SELECTCOLUMNS in DAX is a projection function, has nothing in common with SQL's subselect. www.dax.guide/selectcolumns 

Greg_Deckler
Community Champion
Community Champion

@rpereirait Just wrap another SELECTCOLUMNS statement around what you already have?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler , I haven't tried a new SELECTCOLUMNS around what I'm already have yet, but I'll. Any ideas on what I could put in the table declaration, since the selectcolumns syntax asks me to do that? SELECTCOLUMNS(<table>, <name>, <scalar_expression> [, <name>, <scalar_expression>]…)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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