Consider the problem of charting the monthly sales for a given customer. For a number of reasons, the input feed to the charting widget might have data for some months missing. Not understanding the data, the charting widget would only plot the months with sales and missing months will not appear in the chart. For a specific example, try charting the feed titled Montly sales for a given customer and year
One solution to the problem is to build a data mashup to insert a 0 amount for each of the missing months. To do that,
1. Create a feed containing all twelve months of the year. (For an example, see the feed titled "CSV feed containing 12 rows, one per month" ).
2. Create a new data mashup
3. Use one Source operator to bring in the original sales feed
4. Use another Source operator to bring in the feed created in step 1. Connect a Transform operator to it and manually create an entry having the same structure as the sales feed (in step 3). In particular, for our example, create an element "orderamt" with a value of 0 in each entry and make sure that we have an element named "month" containing the month as integer.
5. Combine the output from step 3 and 4.
6. Use a group operator to put elements belonging to the same month from the two feeds together. Again, back to our specific example. For months which are missing from the original sales feed, there would only be one "orderamt". For months where sales data is available, there will be two "orderamt", one from the sales feed and one from the dummy "orderamt" element created in step 4.
7. Use the "sum" function in Transform to "collapsed" the two "orderamt" back into one amount.
The steps above are illustrated in the sample data mashup titled Monthly sales for a given customer and year - MISSING MONTHS INSERTED