Forum Discussion
IsmaelConsult
3 years agoFrequent Visitor
Wrong Total
How can i fix my total in a matrix. The expresions are: Saldos:= CALCULATE(SUM(Saldos[Entrada])-SUM(Saldos[Saida])) Estoque:= VAR DATAINI=FIRSTDATE(ALL('Calendar'[Data])) VAR ...
Greg_Deckler
3 years agoCommunity Champion
IsmaelConsult First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8
IsmaelConsult
3 years agoFrequent Visitor
Greg_Deckler
I try with this metric:
Valor Estoque =
VAR UltimoCusto = CALCULATE(
LASTNONBLANK(Saldos[Preco_Custo_Medio]; 0);
VALUES(Produtos[Nome_Produto]);
FILTER(
ALL(Saldos);
Saldos[Data_Movimento] = MAX( Saldos[Data_Movimento])
);
ALL('Calendar')
)
VAR _VlrEstoque = [Saldo_Retro]*UltimoCusto
VAR _Table = SUMMARIZE(VALUES(Produtos[Nome_Produto]);"_value";_VlrEstoque)
RETURN
IF(HASONEVALUE(Produtos[Nome_Produto]);_VlrEstoque;SUMX(_Table;_VlrEstoque))
But not works.
But not works.
- Greg_Deckler3 years agoCommunity Champion
IsmaelConsult Can't do it like that, that's not how VAR's work. Use 2 separate measures like in the example.