Forum Discussion
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 DATAFIM=LASTDATE('Calendar'[Data])
VAR Estoque = CALCULATE(_Medidas[Saldos],
ALL(Saldos[Tipo]),
DATESBETWEEN('Calendar'[Data],DATAINI,DATAFIM))
RETURN
Estoque
13 Replies
- Greg_DecklerCommunity 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- IsmaelConsultFrequent 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]*UltimoCustoVAR _Table = SUMMARIZE(VALUES(Produtos[Nome_Produto]);"_value";_VlrEstoque)RETURNIF(HASONEVALUE(Produtos[Nome_Produto]);_VlrEstoque;SUMX(_Table;_VlrEstoque))
But not works.- Greg_DecklerCommunity Champion
IsmaelConsult Can't do it like that, that's not how VAR's work. Use 2 separate measures like in the example.
- IsmaelConsultFrequent Visitor
I separated the measurements but it didn't work, here's the link to the file so you can analyze it better. I also changed the column and measurement names to English.
https://drive.google.com/file/d/1wdZ1YnBT2BqekXoaPc3yZhkpth_X5i83/view?usp=share_linkI need to calculate the inventory on the selected date. Physical inventory and inventory value.
I can calculate the measurements, but the totals are not adding up
Thanks,
- Ashish_MathurSuper User
Hi,
Please describe the question, share data in a format that can be pasted in an MS Excel file and show the expected result. If possible, could you share the column names in English language?
- IsmaelConsultFrequent Visitor
https://drive.google.com/file/d/1wdZ1YnBT2BqekXoaPc3yZhkpth_X5i83/view?usp=share_linkI need to calculate the inventory on the selected date. Physical inventory and inventory value.
I can calculate the measurements, but the totals are not adding up
Thanks,
- Ashish_MathurSuper User
- IsmaelConsultFrequent Visitor
I changed the column and measurement names to English.