So I have some measures created, with an example table such as:
Fruit | Fruit Measure | Value |
---|---|---|
banana | sweetness | 90 |
banana | sweetness | 80 |
banana | tartness | 15 |
banana | tartness | 20 |
peach | sweetness | 70 |
peach | sweetness | 65 |
peach | tartness | 35 |
peach | tartness | 40 |
apple | sweetness | 65 |
apple | sweetness | 60 |
apple | tartness | 30 |
apple | tartness | 25 |
kiwi | sweetness | 20 |
kiwi | sweetness | 15 |
kiwi | tartness | 85 |
kiwi | tartness | 90 |
etc etc.
[edit] for clarification:
Basically, I have a category Fruit
with an associated Fruit Measure
, and I have created the following measures to get a summation of the multiple sweetness/tartness values for each fruit. I also take the percentage of column total (since the sweetness/tartness values are on a different scale and not inherently comparable). As an example: %ColTotal = bananaSweetness/TotalFruitSweetness => 170/(170 + 135 + 125 + 35) = .3656
, as follows:
SumPerFruit =
SUMX ( VALUES ( Table[Fruit Measure] ), CALCULATE ( SUM ( Table[Value] ) ) )
PercentageofColTotal_SumPerFruit =
DIVIDE (
[SumPerFruit],
SUMX (
VALUES ( Table[Fruit Measure] ),
CALCULATE ( SUM ( Table[Value] ), ALLSELECTED ( table[Fruit] ) )
)
)
This results with calculations like the following :
Fruit | Fruit Measure | SumPerFruit | PercentageofColTotal_SumPerFruit |
---|---|---|---|
banana | sweetness | 170 | .3656 |
banana | tartness | 55 | .1029 |
peach | sweetness | 135 | .2903 |
peach | tartness | 75 | .2206 |
apple | sweetness | 125 | .2688 |
apple | tartness | 55 | .1618 |
kiwi | sweetness | 35 | .0753 |
kiwi | tartness | 175 | .5147 |
[EDIT] for more clarification on SummaryFruitMeasure
Now, the above measures just combine the multiple sweetness/tartness values for each fruit into two values for every fruit-- one for tart, and one for sweet. Ideally, I just want to have one numerical average value that can summarize both the sweetness/tartness values for a fruit. Thus, I want to just take an average like the following:
BananaSummaryMeasure = (BananaTartness + BananaSweetness)/2 => (.3656 + .1029)/2
so I tried to get the average of PercentageofColtotal_SumPerFruit
for every fruit as follows:
SummaryFruitMeasure =
SUMX (
VALUES ( Table[Fruit] ),
CALCULATE ( DIVIDE ( SUM ( Table[PercentageofColTotal_SumPerFruit] ), 2 ) )
)
with the intended result of:
Fruit | SummaryFruitMeasure |
---|---|
banana | .23425 |
peach | .255545 |
apple | .2153 |
kiwi | .295 |
However, I get an error with the SUM(Table[PercentageofColTotal_SumPerFruit])
section as follows:
Column
PercentageofColTotal_SumPerFruit
in table "Table" cannot be found or may not be used in this expression.
So I'm assuming that it can't be used in this expression because it's a measure. How do I get around this? Should I be using SUMMARIZECOLUMNS
or something like that? I'm not sure if its possible to aggregate further on PercentageofColTotal_SumPerFruit
?
Also, I have to use measures because the actual data would be filtered on.
[edit] I've also looked into something like this but that results in a table, and I want a measure at the end of this..
SummaryFruitMesure
intended to represent? How is it interpreted? - Alexis Olson