Forum Discussion

ThiagoProfitt's avatar
ThiagoProfitt
Frequent Visitor
5 years ago
Solved

Running Totals AND SUM in the same Matrix

I'm currently developing a cash flow matrix and failed while trying to merge two measures in one (running totals and sum): My idea was to add boolean indicators (Calculado Column) as such: So...
  • ThiagoProfitt's avatar
    5 years ago

    Managed to fix it:
    Had to add an Index column and edit the measure:

    Subtotal = 

    var Calculado= SELECTEDVALUE(Categorias[Calculado])

    var ordemContexto = Max('Categorias'[Índice])

    var ValorSubtotalresumo =

    CALCULATE([Running Total],Filter(ALLNOBLANKROW('Categorias'), 'Categorias'[Índice] >= ordemContexto))

    Return

    SWITCH(

    True(),

    Calculado = 0, [Total],

    Calculado = 1, ValorSubtotalresumo,

    BLANK()

    )