Forum Discussion

vrossouw's avatar
vrossouw
Icon for Helper III rankHelper III
6 years ago
Solved

Add to a "Summarize" Table

Hi, I have created a new table with the "Summarize" function. 

 

New Table = SUMMARIZE(Sales,Sales[Part Number],"Total Sales per Item",
CALCULATE(Sales[Sales Value]))
 
How can I also bring in the Year column from the Sales Table?  Seems as if the summarize function only accept measures. The year column is in a text type format.
 
There is a relationship between the New Table and Sales Table.  If I attempt to add the year to the New Table, link column, which is 'part number', change to multiple rows in the New Table.
 
Then the relationship change to 'many to many' and the data no longer makes sense.  I want to filter on the year, and both visuals, from both tables, must be interactive.
 
 Sales Table
Part NumberSales ValueYear
A90555A5453262019
A90555A4373812020
A90555A5682922021
C90558A5560032019
C90558A4983432020
C90558A3012232021
E90557A8316832019
E90557A8399772020
E90557A4755632021
 
 
New Table  (How do I bring the year into this table). Related function does not seem to work.
Part NumberTotal Sales per Item
A90555A1550999
C90558A1355569
E90557A2147223
 
 
 Thanks in advance
 
  • Hi, vrossouw 

    Based on your description, it is available to create a calculated table as follows.

    New = SUMMARIZE(

        Sales,

        Sales[Part Number],

        Sales[Year],

        "Total Sales per Item",

        CALCULATE(SUM(Sales[Sales Value])

    ))

     

    While the result of summarize function is the same as the sales table. If you want to repeat a table, you can click ‘Edit Query’, go to Query Editor, right-click the sales query and choose ‘Duplicate’ to get a same table.
     

    If you want to filter on the year, you can use ‘Part Number’, ‘Sales Value’ in a table visual and use ‘Year’ as the slicer to filter it.

     

    If I misunderstand your thought, please show me your expected output. I am glad to solve the problem for you.

     

    Best Regards,

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, vrossouw 

    Based on your description, it is available to create a calculated table as follows.

    New = SUMMARIZE(

        Sales,

        Sales[Part Number],

        Sales[Year],

        "Total Sales per Item",

        CALCULATE(SUM(Sales[Sales Value])

    ))

     

    While the result of summarize function is the same as the sales table. If you want to repeat a table, you can click ‘Edit Query’, go to Query Editor, right-click the sales query and choose ‘Duplicate’ to get a same table.
     

    If you want to filter on the year, you can use ‘Part Number’, ‘Sales Value’ in a table visual and use ‘Year’ as the slicer to filter it.

     

    If I misunderstand your thought, please show me your expected output. I am glad to solve the problem for you.

     

    Best Regards,

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • mwegener's avatar
    mwegener
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hi vrossouw,

     

     

    New Table = SUMMARIZE(Sales,Sales[Part Number],Sales[Year],"Total Sales per Item and Year",
    CALCULATE(Sales[Sales Value]))

     

     

    does it make sense what you want to do?

    Why is there a relationship between the New Table and Sales Table?

     

     

    If I answered your question, please mark my post as solution, this will also help others.

    Please give Kudos for support.