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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Issues using FILTER in combination with SUM

I am trying to make a custom measure. What I want is to:

 

  1. Filter out some rows from an existing table.
  2. Then from the filtered table select a certain column.
  3. Then square all values in the column.
  4. Then sum all values in the column.

 

I thought I could use a FILTER to do this but that won't work. I am getting an error telling me the syntax for the SUM function is incorrect (have not even squared the number yet).

 

SUM(FILTER(MyTable, MyTable[class] = "1")[columnToSelect])

1 ACCEPTED SOLUTION

Hi @Anonymous !

Create a new column using following DAX to have Sqr. values of your column;

 

SqrtColumn = SQRT(Table[Column])

 

Now you can use this new column in your DAX measure formula;

 

Class = CALCULATE(SUM(Table[SqrtColumn]), FILTER(Table, Table[Class] = "1"))

 

Regards,

Hasham

View solution in original post

3 REPLIES 3
HashamNiaz
Solution Sage
Solution Sage

Hi @Anonymous !

You can use following DAX coede;

 

Class = CALCULATE(SUM(Table[Column]), FILTER(Table, Table[Class] = "1"))

 

Table is your table name & column is your column you want to sum.

 

Regards,

Hasham

Anonymous
Not applicable

How would one square all values before summing them?

Hi @Anonymous !

Create a new column using following DAX to have Sqr. values of your column;

 

SqrtColumn = SQRT(Table[Column])

 

Now you can use this new column in your DAX measure formula;

 

Class = CALCULATE(SUM(Table[SqrtColumn]), FILTER(Table, Table[Class] = "1"))

 

Regards,

Hasham

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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