Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

AVERAGEX over a virtual table and REMOVEFILTERS

Hi Guys,

 

I am trying to create a measure that is not filtered by multiple slicers on my report, however, I am finding this difficult to resolve.

I am aiming to attain one static value by creating a virtual table using SUMMARIZE function, then trying to get an average from that, using the following DAX.

 

MD Team Average - Accel >2 m/s² =
VAR tbl_acc_2 =
SUMMARIZE (
    FILTER (
        'GPS Match Data', NOT CONTAINSSTRING('GPS Match Data'[Session Type], "U21" ) &&
        NOT 'GPS Match Data'[Name]
            IN {
                "Joe Bloggs",
                "Joe Bloggs1"
            }
    && 'GPS Match Data'[Date] > DATE(2023,07,01)),'GPS Match Data'[Date],'GPS Match Data'[Session Type], "Value", ROUND(DIVIDE(SUM('GPS Match Data'[Accels (>2 m/s²)]),10),0))
VAR MD_acc_2 = AVERAGEX(tbl_acc_2,[Value])
RETURN
CALCULATE(AVERAGEX(tbl_acc_2,[Value]), REMOVEFILTERS())
 
I am not sure if I'm writing the DAX wrong. Any help would be appreciated.

 

Thanks in advance

  • Hi Anonymous - I have done slight modification on the above measure, can you please check 

     

    MD Team Average - Accel >2 m/s² =
    VAR tbl_acc_2 =
    SUMMARIZE (
    FILTER (
    ALL('GPS Match Data'), // Use ALL to ignore any slicers
    NOT CONTAINSSTRING('GPS Match Data'[Session Type], "U21") &&
    NOT 'GPS Match Data'[Name] IN { "Joe Bloggs", "Joe Bloggs1" } &&
    'GPS Match Data'[Date] > DATE(2023, 7, 1)
    ),
    'GPS Match Data'[Date],
    'GPS Match Data'[Session Type],
    "Value", ROUND(DIVIDE(SUM('GPS Match Data'[Accels (>2 m/s²)]), 10), 0)
    )
    VAR MD_acc_2 = AVERAGEX(tbl_acc_2, [Value])
    RETURN
    MD_acc_2

     

    Hope it works. 

1 Reply

  • Hi Anonymous - I have done slight modification on the above measure, can you please check 

     

    MD Team Average - Accel >2 m/s² =
    VAR tbl_acc_2 =
    SUMMARIZE (
    FILTER (
    ALL('GPS Match Data'), // Use ALL to ignore any slicers
    NOT CONTAINSSTRING('GPS Match Data'[Session Type], "U21") &&
    NOT 'GPS Match Data'[Name] IN { "Joe Bloggs", "Joe Bloggs1" } &&
    'GPS Match Data'[Date] > DATE(2023, 7, 1)
    ),
    'GPS Match Data'[Date],
    'GPS Match Data'[Session Type],
    "Value", ROUND(DIVIDE(SUM('GPS Match Data'[Accels (>2 m/s²)]), 10), 0)
    )
    VAR MD_acc_2 = AVERAGEX(tbl_acc_2, [Value])
    RETURN
    MD_acc_2

     

    Hope it works.