Forum Discussion
t-dahen
Microsoft Employee
6 years agoRemove All Filters but Specify New Filter
Hello,
Is there a way to remove all filters but specify a new filter inside a dax expression?
For example, what I would think to do is:
Measure = Calculate(SUM(Table[row1]), Table[row2] = "Something", ALLEXCEPT(Table, Table[row2]))
Try this. I used the logic I gave for the total, then used a slight different logic for the current total used as the numerator.
Type A Total = VAR varTypeATotal = SUMX( FILTER( ALL( 'Data Table' ), 'Data Table'[Type] = "A" ), 'Data Table'[Total] ) VAR varCurrentTotal = SUMX( FILTER( 'Data Table', 'Data Table'[Type] = "A" ), 'Data Table'[Total] ) VAR varPercentOfTotal = DIVIDE(varCurrentTotal, varTypeATotal, 0) RETURN varPercentOfTotal
7 Replies
- edhans
Community Champion
Will this do what you need?
Measure = CALCULATE( SUM( Table[row1] ), FILTER( ALL( Table ), Table[Row2] = "Something" ) )It removes the filter from table, then returns only where the [Row2] field = "Something"
- t-dahen
Microsoft Employee
Hmm, the measure filters based on "row2", but when I select a filter the measure changes. This makes it seem the ALL(Table) is not working.
- edhans
Community Champion
You'll need to give more info, or perhaps share a PBIX file with some sample data.
How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum