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

Linking Tables One to Many - Cumulative Value Issues

Hi All,

 

 

I have two queries that I have linked as a 1 to many ratio by Sales Order # as the unique identifier.

 

Query 1 - Has sales order for each individual row without "sales value"$ amount but other metrics.

 

Query 2 - Has multiple rows per sales order with sales value $ listed per each item on the sales order.

 

 

 

When I filter through each visualization, the sum of sales value appears to filter on the total value of the sales order with any sales order that has that item listed.

 

 

Instead I would like to have it just filter on the total value for sales for that item.

 

 

Any help would be greatly appreciated.

6 REPLIES 6
Greg_Deckler
Super User
Super User

Can you post some sample data, it sounds like you need an Item table, or you need to use your Sales Order # from your Sales Order table. Or, I can't quite say, some sample data would help me recreate it.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

So I have three queries with Sales Order as the unique value

 

 

Query 1

 

Sales OrderWeightFill Rate
10140,00097.20%
10235,00096.80%
10335,00098.00%
10441,00099.00%
10542,00095.23%
10640,00094.60%
10737,00086.00%

 

 

Query 2

Sales OrderItemUnits Ordered
101A10
101B15
101C10
101D5
102A5
102D8
103A6
103B10
103C10
103D9
104B8
104C7
104D7
105B10
105C10
106A20
107A20
107D

25

 

Query 3

 

Sales OrderItemSales
101A$30.00
101B$35.00
101C$60.00
101D$70.00
102A$20.00
102D$22.00
103A$27.00
103B$34.00
103C$11.00
103D$9.00
104B$14.00
104C$23.00
104D$7.00
105B$40.00
105C$22.00
106A$47.00
107A$34.00
107D$28.00

 

 

I have a Card with a sum of sales, and a column chart visualization with units ordered, units shipped with several drilldown levels starting with brand>product family>product group>item. When filtering by item the sum of "sales" appears to be taking the sum or all orders with that item so if I have it filtered by item A, instead of giving me a sum of sales for item A it is giving me a sum of total sales orders that have item A included. So instead of the sum being $158 for item A, it is coming back as $427.

OK, so what I did was create your queries in an example. I related Sales Orders (Query 1) and Sales Quantities (Query 3) on Sales Order. Then I created a matrix with Sales Order from Sales Order table, Item from Sales Quantities table and Sales from Sales Quantities table, seemed to work swell. Let me know if you want me to post some screen shots.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Yes I would appreciate it, I have searched for info on merging the queries. I need something similar to a sum-if in excel basically sum if sales order, item.

Hi @SCPowerBI,

I create a Matrix visual and Card visual using your sample data, does the following screenshot display your expected result?
1.PNG



When I filter item to A, the two visuals return correct values as follows. For more details, please check the attached PBIX file.
2.PNG



Thanks,
Lydia Zhang

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

So, what you could do is a couple things. One, you could create 2 slicers, one for Sales Order and one for Item. Slice by Sales Order and then slice by Item. You could also consider joining your Query 2 and Query 3 together based upon Sales Order and Item (composite key). I'll have to spend some time trying to recreate your issue but I get the sense from your description that you are not filtering on Sales Order so Sales Order is not a contextual filter so therefore it does not play into the calculations of the sums.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.