Forum Discussion

EGM_Alycia's avatar
EGM_Alycia
Regular Visitor
2 years ago
Solved

Creating measure that will calculate a %

I am trying to build a new Measure that will take the filtered column and Divide by a total column. I am struggling with getting the filtered option to stay in my calculations. 
Any help would be appreciated 🙂 

2 Replies

  • Hi,

    Share data in a format that can be pasted in an MS Excel file and show the expected result.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  EGM_Alycia ,

     

    Are you referring to calculating the data after filtering and dividing it by the number of rows before filtering, you can consider using the Allselect() function that will calculate the data after filtering.

    ALLSELECTED function (DAX) - DAX | Microsoft Learn

    ALL function (DAX) - DAX | Microsoft Learn

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _sum=
    SUMX(
        ALLSELECTED('Table'),[Value])
    var _count=
    COUNTX(ALL('Table'),'Table'[Group])
    return
    DIVIDE(
        _sum,_count)

    2. Result:

     

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly