I have a complex problem at work. Currently the dimension table runs to over 100,000 lines. I need to include a 3 dimension which would simply render the current solution unworkable (way too slow). Having discussed it with colleagues who use SQL (I don't) they suggested applying multiple filters (derived from the dimension table) to the fact table. Although you can define multiple relationships in Powerpivot only one can be active at a time. I therefore thought to use 'USERELATIONSHIP'. In the help guide to this function it alludes to being able to use this multiple times in a single measure, but provides no examples. It also says that in certain circumstances if they're nested then the inner most takes precedence. This has left me somewhat confused and I'd be grateful for any advice. I've created a test scenario as follows:
1. Fact Table:
2. Dimension Table:
3. Required Output:
4. Clip of the relationships established in Powerpivot. (qryTable1 is Fact Table, qryTable2 is Dimension Table)
5. My attempt at a measure, which does not work:
Any advice on how to make this work would be gratefully received.
Many thanks.
1. Fact Table:
Book1 | |||||
---|---|---|---|---|---|
A | B | C | |||
2 | Key 1 | Key A | Value | ||
3 | 1 | a | 1 | ||
4 | 1 | b | 2 | ||
5 | 2 | c | 4 | ||
6 | 2 | a | 8 | ||
7 | 3 | b | 16 | ||
8 | 3 | a | 32 | ||
Sheet1 |
2. Dimension Table:
Book1 | |||||
---|---|---|---|---|---|
G | H | I | |||
2 | Group | Key 1 | Key A | ||
3 | House | 1 | b | ||
4 | Boats | 2 | c | ||
5 | Stuff | 3 | a | ||
Sheet1 |
3. Required Output:
Book1 | ||||
---|---|---|---|---|
L | M | |||
2 | Expected Results | |||
3 | House | 2 | ||
4 | Boats | 4 | ||
5 | Stuff | 16 | ||
Sheet1 |
4. Clip of the relationships established in Powerpivot. (qryTable1 is Fact Table, qryTable2 is Dimension Table)
5. My attempt at a measure, which does not work:
Power Query:
=CALCULATE(SUM((qryTable1[Value]),
USERELATIONSHIP(qryTable1[Key 1],qryTable2[Key 1]),
USERELATIONSHIP(qryTable1[Key A],qryTable2[Key A])
)
Any advice on how to make this work would be gratefully received.
Many thanks.