Forum Discussion

t-dahen's avatar
t-dahen
Microsoft Employee
6 years ago
Solved

Remove 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]), Tab...
  • edhans's avatar
    edhans
    6 years ago

    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