The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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!
SELECTCOLUMNS in DAX is a projection function, has nothing in common with SQL's subselect. www.dax.guide/selectcolumns
@rpereirait Just wrap another SELECTCOLUMNS statement around what you already have?
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>]…)
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
20 | |
12 | |
10 | |
7 |