Forum Discussion
numerical filter excluding range
Hello,
I look for a possability to fiter my data (for example numerical values from -10 to 10) with a slicer. As a result I like to have all data for example from -10 to -5 AND from 6 to 10.
Maybe there is a possibility to combine two slicers with an OR? Maybe there is a way to switch the filter from include to exclude? The user has to be manage the selection easily. Any suggestions?
Best regards
wbart
Hi wbart ,
I agree with amitchandak idea, but it seems that there are still some small problems in the formula. I did the following test:
M = VAR _max = MAXX ( ALLSELECTED ( Slicer1 ), Slicer1[filter1] ) VAR _min = MINX ( ALLSELECTED ( Slicer1 ), Slicer1[filter1] ) VAR _max1 = MAXX ( ALLSELECTED ( Slicer2 ), Slicer2[filter2] ) VAR _min1 = MINX ( ALLSELECTED ( Slicer2 ), Slicer2[filter2] ) RETURN CALCULATE ( SUM ( 'Table'[Data] ), FILTER ( 'Table', ( MAX ( 'Table'[Data] ) <= _max && MAX ( 'Table'[Data] ) >= _min ) || ( MAX ( 'Table'[Data] ) <= _max1 && MAX ( 'Table'[Data] ) >= _min1 ) ) )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandakSuper User
wbart , In that case, the slicer should come from an independent table
example
New measure =
var _max = maxx(allselected('Slicer1'), 'Slicer1'[value])
var _min = minx(allselected('Slicer1'), 'Slicer1'[value])var _max1 = maxx(allselected('Slicer2'), 'Slicer1'[value])
var _min1 = minx(allselected('Slicer3'), 'Slicer1'[value])
return
calculate(sum(Table[Value]) , filter(Table , (table[Value] >=_min && table[Value] <=_max) || (table[Value] >=_min1 && table[Value] <=_max1) ))refer:Need of an Independent Table in Power BI: https://youtu.be/lOEW-YUrAbE
- v-henryk-mstfCommunity Support
Hi wbart ,
I agree with amitchandak idea, but it seems that there are still some small problems in the formula. I did the following test:
M = VAR _max = MAXX ( ALLSELECTED ( Slicer1 ), Slicer1[filter1] ) VAR _min = MINX ( ALLSELECTED ( Slicer1 ), Slicer1[filter1] ) VAR _max1 = MAXX ( ALLSELECTED ( Slicer2 ), Slicer2[filter2] ) VAR _min1 = MINX ( ALLSELECTED ( Slicer2 ), Slicer2[filter2] ) RETURN CALCULATE ( SUM ( 'Table'[Data] ), FILTER ( 'Table', ( MAX ( 'Table'[Data] ) <= _max && MAX ( 'Table'[Data] ) >= _min ) || ( MAX ( 'Table'[Data] ) <= _max1 && MAX ( 'Table'[Data] ) >= _min1 ) ) )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.