Forum Discussion
xyz
- 6 years ago
Hi,
According to your description, I create a table to test:
Please take following steps:
1)Create a table by enter data:
2)Choose column [slicer] as a slicer visual and create a check measure:
Check = SWITCH(true,MAX('Slicer'[Slicer])="A",1,MAX('Slicer'[Slicer])="B",2,MAX('Slicer'[Slicer])="C",3,MAX('Slicer'[Slicer])="D",4,MAX('Slicer'[Slicer])="E",5)
3)Create a measure to calculate D and E:
Value-Test =
var a = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="A"))
var b = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="B"))
var c = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="C"))
var d = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="A"||'Table'[Variable A]="B"||'Table'[Variable A]="C"))
var e = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="A"||'Table'[Variable A]="C"))
return
SWITCH([Check],1,a,2,b,3,c,4,d,5,e)
4)Choose D or E in slicer to test, and the result shows:
Here is my test pbix file:
Best Regards,
Giotto Zhi
Hi,
According to your description, I create a table to test:
Please take following steps:
1)Create a table by enter data:
2)Choose column [slicer] as a slicer visual and create a check measure:
Check = SWITCH(true,MAX('Slicer'[Slicer])="A",1,MAX('Slicer'[Slicer])="B",2,MAX('Slicer'[Slicer])="C",3,MAX('Slicer'[Slicer])="D",4,MAX('Slicer'[Slicer])="E",5)
3)Create a measure to calculate D and E:
Value-Test =
var a = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="A"))
var b = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="B"))
var c = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="C"))
var d = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="A"||'Table'[Variable A]="B"||'Table'[Variable A]="C"))
var e = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Variable A]="A"||'Table'[Variable A]="C"))
return
SWITCH([Check],1,a,2,b,3,c,4,d,5,e)
4)Choose D or E in slicer to test, and the result shows:
Here is my test pbix file:
Best Regards,
Giotto Zhi