Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello.
I have sales data for number of products sold per staff member that looks like this, with the totals being calculated vertically, how can it be calculated horizontally as well?
My data:
Name Gloves Hats Scarfs
James 3 2 4
Jane 1 3 2
Chris 0 1 1
Power Bi adds the total as summing vertically:
Total 4 6 7
How can I make it look like this?
Name Gloves Hats Scarfs Total
James 3 2 4 10
Jane 1 3 2 6
Chris 0 1 1 2
I guess I have to create a measure? I don't want the Total vertically, just horizontally.
Many thanks.
Solved! Go to Solution.
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)
Hi,
Your data is not well structures. It should ideally be a 3 column dataset - Name, Item and Value. The item column should have Gloves, Scarfs and Hats. To do so, in the Query Editor window, right click on the first column and select "Unpivot other columns". Click on Close and Load. Now build your visual.
You can create a measure like this:
Total = SUMX(Sales, Sales[Gloves] + Sales[Hats] + Sales[Scarfs])
Then simple drag it to your table
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)
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
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.
Thanks very much for this, @Anonymous. Let me try it out and see.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
66 | |
65 | |
56 | |
39 | |
27 |
User | Count |
---|---|
85 | |
59 | |
45 | |
42 | |
39 |