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
MarkEi
Regular Visitor

Tables Relationship and calculations

Dear all,

 

I'm very new to the Power BI platform and need to create some application.

My target is as follows :

 

Let's say I have a few fruit stocks.  

Also, I have very long list Product_Name vs Qty. for each stock.

These lists can include repetitive items.

I want to create a table that will show me the calculated quantities in every stock.

 

There is an example of how it should looks like in the image below (Final Calculated Stock) :

 

CalculatedStock.PNG

 

Also, I would want to know whether it can be done without using queries.

 

Any help would be appreciated 🙂

 

 

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @MarkEi,

 

Establish one to many relationships between product table and stock tables based on [Product_Name] field.

3.PNG

 

Then, add 'Product List'[Product_Name], 'FirstStock'[Qty] and 'SecondStock'[Qty] to table visual. Choose "Sum" to aggregate Qty column.

2.PNG

 

Alternatively, you can new a calculated table, then, insert a Matrix to display data.

Table1 = UNION(ADDCOLUMNS(FirstStock,"Category","FirstStock"),ADDCOLUMNS(SecondStock,"Category","SecondStock"))

4.PNG1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @MarkEi,

 

Establish one to many relationships between product table and stock tables based on [Product_Name] field.

3.PNG

 

Then, add 'Product List'[Product_Name], 'FirstStock'[Qty] and 'SecondStock'[Qty] to table visual. Choose "Sum" to aggregate Qty column.

2.PNG

 

Alternatively, you can new a calculated table, then, insert a Matrix to display data.

Table1 = UNION(ADDCOLUMNS(FirstStock,"Category","FirstStock"),ADDCOLUMNS(SecondStock,"Category","SecondStock"))

4.PNG1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
nirvana_moksh
Impactful Individual
Impactful Individual

If you have multiple Product Name lists then when importing all these lists create a UNION of all these and you will have a single query and then when you create a data table and doing all transformations -> Add Product Name and Qty and then you can 'SUM' the quantity easily using the drop down pill next to QTY under the Values tab on the right.

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.