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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
lastnn30
Post Patron
Post Patron

Functions for a calculated column

Hi

I want to create a calculated column for this table. I have 2 columsn and I want to add them and out the result in the calculated column.  If I write this formula

 

= RoundTb[Amount] + RoundTb[bonus]

 

Everything is fine, but if i write this

 

=Sum(RoundTb[Amount] + RoundTb[bonus])

 

I get the message below. Does that mean for New Column, I can not use DAX function, only formulas? Thank you very much.

 

SNAG-0991.jpg

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lastnn30 ,

 

The SUM() function can contain only one column name.

The SUM() function adds up the values of the fields in the calculated column.

vstephenmsft_0-1669612386021.png

vstephenmsft_1-1669612399759.png

If you still want to use the SUM() function to return the value of each row, you can write like the following.

Column = CALCULATE(SUM('RoundTb'[Amount]),FILTER('RoundTb',[Amount]=EARLIER('RoundTb'[Amount])&&[bouns]=EARLIER(RoundTb[bouns])&&[item]=EARLIER(RoundTb[item])))

vstephenmsft_3-1669612800167.png

In addition to the calculated column, there is also a measure that gives the result based on the context of the row.

Then measure and calculated columns sometimes return different results because the measure and the calculated column has a different row context. 

vstephenmsft_2-1669612482589.png

Calculated Column and Measure in Power BI (powerbiconsulting.com)

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @lastnn30 ,

 

The SUM() function can contain only one column name.

The SUM() function adds up the values of the fields in the calculated column.

vstephenmsft_0-1669612386021.png

vstephenmsft_1-1669612399759.png

If you still want to use the SUM() function to return the value of each row, you can write like the following.

Column = CALCULATE(SUM('RoundTb'[Amount]),FILTER('RoundTb',[Amount]=EARLIER('RoundTb'[Amount])&&[bouns]=EARLIER(RoundTb[bouns])&&[item]=EARLIER(RoundTb[item])))

vstephenmsft_3-1669612800167.png

In addition to the calculated column, there is also a measure that gives the result based on the context of the row.

Then measure and calculated columns sometimes return different results because the measure and the calculated column has a different row context. 

vstephenmsft_2-1669612482589.png

Calculated Column and Measure in Power BI (powerbiconsulting.com)

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Ashish_Mathur
Super User
Super User

Hi,

In the SUM formula, replace + with ,


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks a lot for your reply. It did not work! please see the screenshot below:

 

SNAG-0992.jpg

You are welcome.  Read my reply again.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I did, that was a type. Sorry. but anyway I did noth

 

=Sum ( col1,col2 )

and 

=Sum (col1 + col2)

Both did not work. Thanks again.

The numbers in the Bonus column are left aligned.  In the Query Editor, change the data type to Numbers.  Thereafter my suggested formula will work.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.