Forum Discussion

TomaKavi's avatar
TomaKavi
Icon for Helper I rankHelper I
4 years ago
Solved

how tu sum more filtered fields in one column

Hello guys,

is there a better way how to make a simple sum for specific fields in one Column than this below ? 

SR1100 positive 3 =
CALCULATE (
    [Total Value],
    FILTER (
        Total_2021,
        Total_2021[Consolidation account] IN { "V10000", "V20000", "V30000" }
    )
)
  • Hi TomaKavi 

    Thanks for your reply.

    >> I need this measure to be a part of another measure. ....  how to nest the 3 filtered values and sum them together.

    The usual approach is to create a measure to calculate the total, and then create a measure to call it, for example

    measure 1= sumx(filter('table', 'table '[xxx]=....),'table'[value])
    measure 2= 
      var _totalFromM1=[measure 1]
      var _expression=calculate(....)
    return _totalFromM1+_expression

    This is the simplest way.

     

    Best Regards,

    Community Support Team _Tang

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

6 Replies

  • v-xiaotang's avatar
    v-xiaotang
    Icon for Community Support rankCommunity Support

    Hi TomaKavi 

    You can choose according to your scenario. If you only need to call it once, use this method. 

    If you need to call it multiple times, create a table.

    test = 
    CALCULATE (
        SUM(Total_2021[value]),
        FILTER (
            Total_2021,
            Total_2021[Consolidation account] IN VALUES('filter'[Column1])
        )
    )

    Best Regards,

    Community Support Team _Tang

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

  • actually not, I need this measure to be a part of another measure. I was more asking if there is another way ( a bit simple) how to nest the 3 filtered values and sum them together.

    • v-xiaotang's avatar
      v-xiaotang
      Icon for Community Support rankCommunity Support

      Hi TomaKavi 

      Thanks for your reply.

      >> I need this measure to be a part of another measure. ....  how to nest the 3 filtered values and sum them together.

      The usual approach is to create a measure to calculate the total, and then create a measure to call it, for example

      measure 1= sumx(filter('table', 'table '[xxx]=....),'table'[value])
      measure 2= 
        var _totalFromM1=[measure 1]
        var _expression=calculate(....)
      return _totalFromM1+_expression

      This is the simplest way.

       

      Best Regards,

      Community Support Team _Tang

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

      • TomaKavi's avatar
        TomaKavi
        Icon for Helper I rankHelper I

        and that is the poin HOW to add more values here  ,,Table [xxx] =......., how do you nest more parameters there ?

         

        measure 1= sumx(filter('table', 'table '[xxx]=....),'table'[value])