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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nsethia
New Member

Calculating rows in Power Bi

Hi all,

 

I've separate spreadsheets for each store with data similar to

 

Store A                    Store B

Product   Sales         Product    Sales

Shoes     100            Shoes      150

Shirts       50            Shirts         70      

 

I need to add up total sales in a new column like 

 

Store A                    Store B

Product   Sales         Product    Sales      Total Sales

Shoes     100            Shoes      150                250

Shirts       50            Shirts         70                120

 

Is there a way to do that in Powerbi desktop?

 

Thanks

2 REPLIES 2
v-sihou-msft
Employee
Employee

@nsethia

 

In this scenario, as you already separate tables for each store into different worksheet, you can generate one dataset for each worksheet. Since each dataset has same structure, you can use "merge queries" to combine two tables together. Just rename columns into "Sales for Store A" and "Sales for Store B".

 

4.PNG

 

Then you can easily create a calculated column to calculate the total.

 

Regards,

 

 

Phil_Seamark
Employee
Employee

I take it you have more than 2 stores.  

 

I recommend you append the tables to each other.  This can be done in the Query Editor using the APPEND function in the ribbon, or you can do this in DAX using the UNION fuction.

 

You are after a single table that looks like this

Store    Product Sales
------   ------- ,-------
Store A, Shoes , 100
Store A, Shirts ,50
Store B, Shoes , 150
Store B, Shirts,   70

Once you have your data in this format, you can use the various grid visuals (matrix) to show the data.

 

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.