Forum Discussion
patilpoonam21
2 years agoHelper I
Create a Range Slicer for multiple columns
Hi, I need to show the Range slicer as below for the multiple columns in the Table visual. In the below table for Q1 Att, Q2 Att, Q3 Att and Q4 Att. Is it possible? I am using Power BI Desktop 2...
- 2 years ago
output :
create 4 measures
att q1 measure , att q2 measure, att q3 measure, att q4 measure
all of them same code with one difference : the calculation
check below :
Q1 ATT
q1 att measure = var min_value = MIN(slicer[Value]) var max_value = MAX(slicer[Value]) var dataousrce = FILTER( ADDCOLUMNS( VALUES('Table'[Person]), "@x" ,CALCULATE(SUM('Table'[Q1 Att])) ) ,[@x] >= min_value && [@x] <= max_value ) var res = CALCULATE( SUM('Table'[Q1 Att]), dataousrce ) return resQ2 ATT
Q2 att measure = var min_value = MIN(slicer[Value]) var max_value = MAX(slicer[Value]) var dataousrce = FILTER( ADDCOLUMNS( VALUES('Table'[Person]), "@x" ,CALCULATE(SUM('Table'[Q2 Att])) ) ,[@x] >= min_value && [@x] <= max_value ) var res = CALCULATE( SUM('Table'[Q2 Att]), dataousrce ) return resQ3 ATT
Q3 att measure = var min_value = MIN(slicer[Value]) var max_value = MAX(slicer[Value]) var dataousrce = FILTER( ADDCOLUMNS( VALUES('Table'[Person]), "@x" ,CALCULATE(SUM('Table'[Q3 Att])) ) ,[@x] >= min_value && [@x] <= max_value ) var res = CALCULATE( SUM('Table'[Q3 Att]), dataousrce ) return resATT Q4
Q4 att measure = var min_value = MIN(slicer[Value]) var max_value = MAX(slicer[Value]) var dataousrce = FILTER( ADDCOLUMNS( VALUES('Table'[Person]), "@x" ,CALCULATE(SUM('Table'[Q4 Att])) ) ,[@x] >= min_value && [@x] <= max_value ) var res = CALCULATE( SUM('Table'[Q4 Att]), dataousrce ) return resIf my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
Ashish_Mathur
2 years agoSuper User
Hi,
If Q1 ATT etc. are individual columns in your dataset, then you may want to use the "Unpivot Other Columns" feature to flatten the table. You will then be able to use the slicer easily.