8 Replies Latest reply: Feb 19, 2013 8:41 AM by fredrik.tham RSS

Intersection of dimension in chart?

fredrik.tham

Hello,

 

I'm trying to create a chart that only contains the products that have been sold every year. Consider this simple example:

 

Year     Product     Sale

2008     A               1

2008     B               1

2009     A               1

2010     A               1

2010     B               1

2011     C               1

 

The result I''m looking for is:

 

Year     Product     Sale

2008     A               1

2008     B               1

2010     A               1

2010     B               1

 

It seems to be a simple union but having tried every possible, except the right one, set analysis trick in the book and can't get it to work. Any suggestions?

 

Thanks

Fredrik

  • Re: Intersection of dimension in chart?
    Vishwaranjan Kumar

    hi

    A:

    LOAD * INLINE [

        year, product, sale

        2008, A, 1

        2008, B, 1

        2009, A, 1

        2010, A, 1

        2010, B, 1

        2011, C, 1

    ];

    b:

    LOAD year as newYear,

        product as newProduct,

         sale as newSale

         Resident A Where year ='2008' or year ='2010';

     

    then output like this

    newYearnewProductnewSale
    2008A1
    2008B1
    2010A1
    2010B1
    • Re: Intersection of dimension in chart?
      fredrik.tham

      Hello,

       

      Thanks for your quick response but unfortunately it has to be done dynamically in a chart. That is not in the script.

       

      // Fredrik

      • Re: Intersection of dimension in chart?
        swuehl

        Sorry, I don't get what you want.

         

        None of your products A, B or C is sold in every year (2008,2009,2010 and 2011), so your resulting table should be empty, right?

        • Re: Intersection of dimension in chart?
          fredrik.tham

          Hello,

           

          Correct, my misstake. This is what the example should look like (I removed 2008 to make it easier):

           

          Year     Product     Sale

          2009     A               1

          2009     B               1

          2010     A               1

          2010     B               1

          2010     C               1

           

          The result I''m looking for is:

           

          Year     Product     Sale

          2009     A               1

          2009     B               1

          2010     A               1

          2010     B               1

           

          or¨

           

          Year     Sum(Sale)

          2009     2

          2010     2

           

          Thanks

          Fredrik