Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
ThiagoProfitt
Frequent Visitor

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:

ThiagoProfitt_1-1618920738275.png

So that my measure could do the following:

Subtotal = 

var Calculado = SELECTEDVALUE('Categorias'[Calculado])

var Runningtotal= [Running total]

Return

SWITCH(

True(),

Calculado = 0, [Total],

Calculado = 1, Runningtotal,

BLANK()

)

The referenced measures are:

Running total =
CALCULATE(

    [Total],

    FILTER(

        ALLSELECTED('Calendário'[Data]),

        ISONORAFTER('Calendário'[Data], MAX('Calendário'[Data]), DESC)

    )

)

The [Total] measure:

 

[Total] = SUM(Movimentacoes[nValorTitulo])

When [Running Total] is in a matrix by itself it works absolutely fine, also does [Total], however if I mix both using the [Subtotal] measure, the [Running Total] results in 0 and the sum measure [Total] works just fine.

ThiagoProfitt_2-1618921325334.png
 
Is there any way to mix both of those in the same matrix? or maybe a way to scroll through two matrix visuals at the same time?
1 ACCEPTED SOLUTION
ThiagoProfitt
Frequent Visitor

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()

)

View solution in original post

1 REPLY 1
ThiagoProfitt
Frequent Visitor

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()

)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.