Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Displaying data from two tables in one graph

Hello!

I have two table with matching fields. And I need to represent them both in a chart if possible(sum of Sales per per week). Both table consist of some figures per category oevr a period of time but they can not be merged. The should be combined into one graph to provide a visual comparison of the actual sales and budget targets. Maybe someone can assist with this. Currently I have two separate graphs showing the calculations per week. Also, Table2 consists of only current year figures (so I need to display only this years data); budget is estimated for each month of the year and actual sales table consists of only data starting from the beginning of the year until current week. Examples of the table sare presented below.

    Table1-Actual Sales

ItemCategoryEURYearMonth
ItemACategory1209,4020141
ItemBCategory2500,1720152
ItemCCategory3315,8220151
ItemDCategory2740,1120142
ItemECategory2599,5120143
ItemFCategory3880,9020152
ItemGCategory2772,0520151

    Table2-Budget

CategoryEURYearMonth
Category1529,8520151
Category2874,5020152
Category3508,7820151
Category1830,3120151
Category2359,1220152
Category3432,1920153
3 Replies
avinashelite

Since the data cannot be combined, try to build a composite key between the two tables , that will server the purpose I guess

composite key like :

Actual_Sales:

Load

Category&'-'&Year&'-'&Month as Key,

....


Budget:

Load

Category&'-'&Year&'-'&Month as Key,

....

..


This will give the desired result



Gysbert_Wassenaar

    Table2-Budget

CategoryEURYearMonth
Category1529,8520151
Category2874,5020152
Category3508,7820151
Category1830,3120151
Category2359,1220152
Category3432,1920153

Why do you have two rows for the same Category for the same period of the same year? Which one has the correct budget for the category?


talk is cheap, supply exceeds demand
puttemans
Specialist
Specialist

How about loading your budget figures into your sales table?

map_budget:

MAPPING LOAD
Category&Year&Month,
EUR
FROM
your budget table

Sales:
LOAD Item,
Category,
EUR as Sales,
Year,
Month,
Applymap('map_budget', Category&Year&Month) as Budget
FROM
your sales table