Forum Discussion

SCPowerBI's avatar
SCPowerBI
Regular Visitor
9 years ago

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

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    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.

    • SCPowerBI's avatar
      SCPowerBI
      Regular Visitor

      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.

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        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.