Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Bukan4x4
Contributor III
Contributor III

data model for grouping by 2 field

Hi everyone,

Please, try to help me with this, I have model data like this:

 

Bukan4x4_0-1619207475425.png

Tree tables associate by category field.

In my sheet a have figure where I can get sales by categories, with this expression: sum(salesA)+sum(salesB)+sum(salesC). that works! But now, I need a new figures group by Category & month. 

In the tables, I set different names for months (montA,.monthB,monthC) fields to avoid creating a synthetic table, but those fields have the same values: January, February, etc. In the sheet I need to know Sales group by Category in January, February, etc.

How I can get this without create a synthetic table? is necessary to modify mi model or is possible to do directly from the sheet?

Thanks in advance.

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

I would consider adjusting the data modell.

Maybe like this:

LOAD Category, salesA as Sales, monthA as Month, 'A' as Type FROM TableA;

CONCATENATE LOAD Category, salesB as Sales, monthB as Month, 'B' as Type FROM TableB;

CONCATENATE LOAD Category, salesC as Sales, monthC as Month, 'C' as Type FROM TableC; 

Then you can just use Sum(Sales) as your expression and your you will have a common Month dimension field for all three value types.

If you do need to pinpoint just one of the three in another object you can do that with set analysis like this: Sum({<Type={'B'}>}Sales)

View solution in original post

2 Replies
Vegar
MVP
MVP

I would consider adjusting the data modell.

Maybe like this:

LOAD Category, salesA as Sales, monthA as Month, 'A' as Type FROM TableA;

CONCATENATE LOAD Category, salesB as Sales, monthB as Month, 'B' as Type FROM TableB;

CONCATENATE LOAD Category, salesC as Sales, monthC as Month, 'C' as Type FROM TableC; 

Then you can just use Sum(Sales) as your expression and your you will have a common Month dimension field for all three value types.

If you do need to pinpoint just one of the three in another object you can do that with set analysis like this: Sum({<Type={'B'}>}Sales)

Bukan4x4
Contributor III
Contributor III
Author

Thanks Vegar, thas works!