areuexperienced
areuexperienced

Reputation: 2071

Sum a column based on hierarchy

I have what seems like a simple problem that I can't figure out.

I have table Revenues that looks like this:

ArticleID | Revenue
0001      | 10000
0002      | 12515

It is related to table Articles that looks like this:

ArticleID | Level 1 | Level 2 | Level 3
0001      | Food    | Meat    | Salami
0002      | Nonfood | Clothes | Sweater

Level 1, Level 2, Level 3 is a hierarchy of labels. This repeats for ~10 000 articles.

I want a measure that sums Revenues at different levels of the hierarchy. Expected output would be e.g. a bar chart that displays the sum of revenues at different levels of the hierarchy. Something like this:

enter image description here

I want to then be able to use this measure in other graphics e.g. a scatter chart where I superimpose it with other measures aggregated in the same way based on Levels.

Seems simple but can't manage it.... Any ideas?

Upvotes: 0

Views: 17

Answers (0)

Related Questions