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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
koorosh
Post Partisan
Post Partisan

[_1] syntax

Hello experts, would you explain what the following measure do? Especially syntax "_1" and [_1] .

 

Measure 3 =

var _cnt = CALCULATE(DISTINCTCOUNT( Sheet1[Course  Name]),ALLSELECTED(Sheet1))

return

Sumx(filter(SUMMARIZE(Sheet1,Sheet1[Partner], "_1",DISTINCTCOUNT(Sheet1[Course  Name])),[_1]=_cnt),[_1])

 

1 ACCEPTED SOLUTION
nandukrishnavs
Community Champion
Community Champion

@koorosh 

 

To explain this, I have modified the measure 

Measure 3 =
VAR _cnt =
    CALCULATE ( DISTINCTCOUNT ( Sheet1[Course  Name] ), ALLSELECTED ( Sheet1 ) )
VAR _summarizedTable =
    SUMMARIZE (
        Sheet1,
        Sheet1[Partner],
        "_1", DISTINCTCOUNT ( Sheet1[Course  Name] )
    )
RETURN
    SUMX ( FILTER ( _summarizedTable, [_1] = _cnt ), [_1] )

"_1" is a column name that you have defined in the SUMMARIZE function. 

 

Below is the syntax of SUMMARIZE

SUMMARIZE (<table>, <groupBy_columnName>[, <groupBy_columnName>]…[, <name>, <expression>]…)

The first parameter is Table, then group by column, then a new column name. In your case, you have specified "_1". Then expression. The output of the expression will be stored in the newly created column "_1".

 

Below is the syntax of SUMX.

SUMX(<table>, <expression>)

The first parameter is a table. and the second parameter is an expression. (The expression to be evaluated for each row of the table)

 

In your example, You wanted to pass a filtered table. That's why you have used FILTER()

Below is the syntax of FILTER()

FILTER(<table>,<filter>)

The first parameter is a table. In your original measure, you have directly specified the SUMMARIZE() that will return a table.

To explain this I have stored the result into a variable. Then the second parameter is a filter condition. ie [_1] = _cnt  

 

Now coming to the context of SUMX(). SUMX will return the sum of the "_1" column in the temporary table "_summarizedTable".

 

 

 


Regards,
Nandu Krishna

View solution in original post

2 REPLIES 2
nandukrishnavs
Community Champion
Community Champion

@koorosh 

 

To explain this, I have modified the measure 

Measure 3 =
VAR _cnt =
    CALCULATE ( DISTINCTCOUNT ( Sheet1[Course  Name] ), ALLSELECTED ( Sheet1 ) )
VAR _summarizedTable =
    SUMMARIZE (
        Sheet1,
        Sheet1[Partner],
        "_1", DISTINCTCOUNT ( Sheet1[Course  Name] )
    )
RETURN
    SUMX ( FILTER ( _summarizedTable, [_1] = _cnt ), [_1] )

"_1" is a column name that you have defined in the SUMMARIZE function. 

 

Below is the syntax of SUMMARIZE

SUMMARIZE (<table>, <groupBy_columnName>[, <groupBy_columnName>]…[, <name>, <expression>]…)

The first parameter is Table, then group by column, then a new column name. In your case, you have specified "_1". Then expression. The output of the expression will be stored in the newly created column "_1".

 

Below is the syntax of SUMX.

SUMX(<table>, <expression>)

The first parameter is a table. and the second parameter is an expression. (The expression to be evaluated for each row of the table)

 

In your example, You wanted to pass a filtered table. That's why you have used FILTER()

Below is the syntax of FILTER()

FILTER(<table>,<filter>)

The first parameter is a table. In your original measure, you have directly specified the SUMMARIZE() that will return a table.

To explain this I have stored the result into a variable. Then the second parameter is a filter condition. ie [_1] = _cnt  

 

Now coming to the context of SUMX(). SUMX will return the sum of the "_1" column in the temporary table "_summarizedTable".

 

 

 


Regards,
Nandu Krishna

AllisonKennedy
Super User
Super User

@koorosh 

 

The square brackets indicate a column or measure name. In this case [_1] is the name of the column you have created using the SUMMARIZE function: https://docs.microsoft.com/en-us/dax/summarize-function-dax

 

Measure 3 =

--this line below creates a variable called _cnt that will take the distinct count of course names in the Sheet 1 table, ignoring all 'filters' from the visualization, basically it gives you a grand total count of distinct courses in Sheet 1 based on your slicer selections

var _cnt = CALCULATE(DISTINCTCOUNT( Sheet1[Course  Name]),ALLSELECTED(Sheet1))

return

--this line creates a virtual table using the SUMMARIZE function, so it groups the Sheet1 table by Partner (creating 1 row for each distinct partner), 

Sumx(filter(SUMMARIZE(Sheet1,Sheet1[Partner]
--then adds a new column to that virtual table, calling that column "_1", and populating that column with a distinct count of course names for each Partner
, "_1",DISTINCTCOUNT(Sheet1[Course  Name]))
-- then it filters the new virtual table so that only the Partners who have the same distinct count of courses as the grand total _cnt we calculated in the variable above are left
,[_1]=_cnt)
-- finally it sums all the distinct counts, so basically takes _cnt * number partners who have same total of distinct courses as _cnt
,[_1])

 

Does that help/make sense?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.

Top Kudoed Authors