Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
49 | |
41 | |
34 |
User | Count |
---|---|
164 | |
111 | |
62 | |
53 | |
38 |