1 Reply Latest reply on Sep 4, 2012 9:08 AM by Tracy Rodgers

    Different level of aggregation in one report

    John Smith

      I need to create reports that will have different level of agregation in different coulumns:

      The first column is total by product and the second by vendor and product:

       

      Or in SQL:

       

      SELECT Product_Code, SUM(total) GROUP BY Product_Code

      And the second is

      SELECT Vendor, Product_Code, SUM(total) GROUP BY Vendor, Product_Code

       

       

      Vendor       | Product Code | Total by Product | Total by product by Vendor |

      -------------+--------------+------------------+----------------------------+

      Vendor1     | AAA          |      2,000       |  1,000                     |

                   | BBB          |      5,000       |  3,000                     |

                   | CCC          |      4,000       |  2,000                     |

                   |              |                  |                            |

       

       

      Vendor       | Product Code | Total by Product | Total by product by Vendor |

      -------------+--------------+------------------+----------------------------+

      Vendor2     | AAA          |      2,000       |  1,000                     |

                   | BBB          |      5,000       |  2,000                     |

                   | CCC          |      4,000       |  1,000                     |

                   |              |                  |                            |

       

      How do I do that?

      John