Forum Discussion
How to sum values horizontally in a table?
- Anonymous8 years ago
You can go to Format pane of your table, and there should be an option for grand total that you can turn it off to remove Total. As for displays 0, you can write the following:
Sales Total =
VAR temp = SUMX(Sales, Sales[Hat] + Sales[Scarf] + Sales[Gloves])
RETURN IF(temp = BLANK(), 0, temp)
Hello Anonymous.
Your measure worked great, thank you!
I used it to make this table:
| Month | Hat | Scarf | Gloves | SalesTotal |
| March | 1 | 6 | 4 | 11 |
| Total | 1 | 6 | 4 | 11 |
In the above, SalesTotal is your measure, and works great, but Total is calculated by Power Bi - how do I remove it?
Also, how can SalesTotal be edited so that if some products have no sales, it displays 0 instead of being blank?
Many thanks.
You can go to Format pane of your table, and there should be an option for grand total that you can turn it off to remove Total. As for displays 0, you can write the following:
Sales Total =
VAR temp = SUMX(Sales, Sales[Hat] + Sales[Scarf] + Sales[Gloves])
RETURN IF(temp = BLANK(), 0, temp)
- tanmaykaushik2 years agoNew Member
Dear Community, I think the solutions to this question have been specific to the question. What I am struggling to solve as a beginner is that what if there are many more rows in your dataset unlike 3 which you can manually make a formula out of.
Could someone please tell me if there is a way to calculate totals/averages/etc for 'n' columns in Power BI horizontally? Just like the sum function works in Excel over the whole row operating on every column in the ROW.
Appreciate the help. Thank you- Ashish_Mathur2 years ago
Super User
Hi,
Share some data to work with, explain the question and show the expected result. Share data in a format that can be pasted in an MS Excel file.