Forum Discussion
charleshale
3 years agoContinued Contributor
Totalling selected values
Let's say I have a table named FRUIT that looks like this: TYPE QUANTITY Bananas 2 Oranges 3 Kiwi 4 My goal is to Sum only Bananas and Oranges and have those sums show only...
- 3 years ago
Hi,
Please check the below picture and the attached pbix file.
expected measure one: = CALCULATE ( SUM ( Fruit[Quantity] ), KEEPFILTERS ( Fruit[Type] IN { "Bananas", "Oranges" } ) )expected measure two: = IF ( HASONEVALUE ( Fruit[Type] ), SUM ( Fruit[Quantity] ), CALCULATE ( SUM ( Fruit[Quantity] ), KEEPFILTERS ( Fruit[Type] IN { "Bananas", "Oranges" } ) ) )
Anonymous
3 years agoNot applicable
Hi charleshale,
Not sure if I understood properly. Since if you are selecting values in the visual filter, that should automatically filter down the sum of values.
However try this -
1. Create a list that will return all values selected -
List = CONCATENATEX(values('Fruit'[TYPE]),'Fruit'[TYPE],",")
2. Create a measure for the totals-
Total = CALCULATE(SUM('Fruit'[QUANTITY]),FILTER('Fruit','Fruit'[TYPE] in {[List]}))
Let me know if this is what you are after.