Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago

Filter on the measure.

I need to create a measure that makes a calculation using the SUMX function but also has a filter, for example SUMX (table; max (year column); column1 * column2) and will also need to create a measure that do the same thing however using the previous year, for example SUMX (table, (max (year column) - '); * column1 column2), made several attempts however unsuccessfully.

29 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    The general formula for a measure like that is:

     

    SUMX(FILTER(...),...)

    Or you can use CALCULATE

    CALCULATE(SUM(...),FILTER(...))

    without sample data, not sure how much more I can help.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Greg_Deckler

       

      I'm trying it

      (SUMX (FILTER (DMEGF_Ano; max (DMEGF_Ano [Year])) facts, facts[Vl_PedidoCompra] * facts [Qtd_PedidoCompra]))

      but it is giving error

      • Sean's avatar
        Sean
        Icon for Community Champion rankCommunity Champion

        Anonymous try this

        delete the facts and add => comma and ( => , (