Forum Discussion

LaurieS's avatar
LaurieS
Helper I
7 years ago
Solved

DAX - Default Filter & ALLEXCEPT

I'm very new in Power BI, and I've written the following DAX and only part of it is working as desired:   Total Runs Global = IF( [CurrentSelectionsToolType]=[TotalSelectionsToolType], CALCU...
  • LaurieS's avatar
    LaurieS
    7 years ago

    Thank you so much for your prompt reply. I had a colleague helping that solved the issue.

     

    His solution: Please check the below measures, instead of using single measure I have separated 'pbi sensor_data'[Tool Type]="ABI" filter into separate measure named ABISensorRuns. Then I used new measure ABISensorRuns in Total Runs Global measure.

     

    ABISensorRuns = CALCULATE(

            sum('pbi sensor_data'[Sensor Runs]),

            FILTER('pbi sensor_data','pbi sensor_data'[Tool Type]="ABI"))

     

    Total Runs Global =

    IF(

        [CurrentSelectionsToolType]=[TotalSelectionsToolType],

         CALCULATE(

            [ABISensorRuns],ALLEXCEPT('pbi luLocations','pbi luLocations'[Region]),

                ALLEXCEPT('pbi luLocations','pbi luLocations'[Country]),ALLEXCEPT('pbi luLocations','pbi luLocations'[Area]),

                ALLEXCEPT('pbi luLocations','pbi luLocations'[District])

          ),

        CALCULATE(sum('pbi sensor_data'[Sensor Runs]),ALLEXCEPT('pbi luLocations','pbi luLocations'[Region]),

                ALLEXCEPT('pbi luLocations','pbi luLocations'[Country]),ALLEXCEPT('pbi luLocations','pbi luLocations'[Area]),

                ALLEXCEPT('pbi luLocations','pbi luLocations'[District])

    ))