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
james_pease
Helper III
Helper III

Sum of a calculated column

Hello everyone, does anyone know how to calculate the sum of a calculated column? Im trying to create a few measures that use calculated columns for values but they are returning blanks. 

james_pease_0-1662154675804.png

Here are my expressions:

measure:
xsqrsum = sum('All_Actual_Sales (2)'[xsq])
Calculated column being referenced: 
xsq = if('All_Actual_Sales (2)'[LN Actual Sales]>0,('All_Actual_Sales (2)'[LN Actual Sales])^2)

Calculated column being referenced:

LN Actual Sales = If('All_Actual_Sales (2)'[Actual Sales Null Values]>0,ln('All_Actual_Sales (2)'[Actual Sales Null Values]))


Measure: 

xsum = sumx( 'All_Actual_Sales (2)',[LN Actual Sales])
Calculated column being referenced

LN Actual Sales = If('All_Actual_Sales (2)'[Actual Sales Null Values]>0,ln('All_Actual_Sales (2)'[Actual Sales Null Values]))

 

Measure:

xysum = sum('All_Actual_Sales (2)'[xy])
Calculated column being reference:
xy = if('All_Actual_Sales (2)'[Actual Sales Null Values]>0, sum('All_Actual_Sales (2)'[LN Actual Sales])*sum('All_Actual_Expenses (2)'[Amount]))
 
Measure:
y-intercept = Divide(
            [ysum]*[xsqrsum]-[xsum]*[ysum],
            [n]*[xsqrsum]-[xsum]^2)
Calculated coulmns being referenced xsq and xy from above.
 
So I know my issues stem from not being able to sum the calculated columns.
 
Thanks in advance!
 
1 ACCEPTED SOLUTION

The problem is I am expecting to get a number as the total (sum of a calculated column should be a number). I am not getting a number, I am getting a blank. So then when I try and caclulate the sum of xy, the y-intercept, and the slope I received blanks because the sum of x is blank. Lastly, when I try and plug everything into the regression formula, the result is blank because the above are blank. 

 

My new approach is to append two queriers into 1 then use filter or if expressions to sum charts with an expense account number and revenues with revenue account numbers. 

View solution in original post

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

OK, you've shown your formulas but you have not shown were the problem really is... Calculated columns are normal columns in a table and they definitely can be used as any other column. Do you get any error? If so, why don't you show it?

The problem is I am expecting to get a number as the total (sum of a calculated column should be a number). I am not getting a number, I am getting a blank. So then when I try and caclulate the sum of xy, the y-intercept, and the slope I received blanks because the sum of x is blank. Lastly, when I try and plug everything into the regression formula, the result is blank because the above are blank. 

 

My new approach is to append two queriers into 1 then use filter or if expressions to sum charts with an expense account number and revenues with revenue account numbers. 

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.