Forum Discussion
A problem with martix total
hey i got i matrix report in power bi project and i got some some measures but one of them doesn't display total in marrix and i dun know why like in the attached photo in totalpayback vlaues
Islam , as mention at the begining, the reason for this os because in total row the difference is in minus and there is no result. The logic is as on detail row, if openings<expense, return 0.
So in order to have "sum" in totals, you need to use IfHasOneValue.
Attached file.
Example:
Regards,TotalPayback New =var _filterArea = FILTER('Table','Table'[Openings]>'Table'[Expenses])RETURNIF(HASONEVALUE('Table'[YearMonth]),IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses]),SUMX(_filterArea,'Table'[Openings]-'Table'[Expenses]))
Nemanja Andic
Attached file.
22 Replies
- PaulDBrown
Community Champion
- nandic
Resident Rockstar
Hi Islam ,
Total value in matrix doesn't behave as we used to see it in Excel.
Total value is not sum of all values in that column. On the other hand, total value is calculated for that "specific total row".
Example: if you are comparing if RequiredToPay is not blank then return some value, it will work on "detail row".
But for "total row" there is a value so it will return some value.
Most popular solution to this is to create condition to check if it is a detail row or total row.
Here we use IfHasOneValue or IsFiltereFunction.
More info you can find here: https://powerpivotpro.com/2014/01/grand-total-mania-totals-at-top-multiple-totals/
Regards,
Nemanja Andic- Islam
Helper V
RequiredToPay = IF([TotalExpenses]-[TotalOpenings] >0,[TotalExpenses]-[TotalOpenings])this measure is working fine but this oneTotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])give me the values without totalsthat's the problem and i don't know what is the problem here- nandic
Resident Rockstar
Islam , could you please add additional information:
1) screenshot where we can also see results for measure "TotalExpenses"
2) dax for measures "TotalExpenses" and "TotalOpenings"
3) screenshot of model (relationships between tables)
All this is needed to find out where is the issue.
Thanks,
Nemanja
- m3tr01d
Continued Contributor
It would be better to give us a sample file where we can actually see the code behind this measure.
Then we can help you change this measure- Islam
Helper V
RequiredToPay = IF([TotalExpenses]-[TotalOpenings] >0,[TotalExpenses]-[TotalOpenings])this measure is working fine but this oneTotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])give me the values without totals
- negi007
Community Champion
Islam In powerbi, there are many relationships between multiple tables which determines the output. So it is possible that there might be some discrepency in the relationship between tables which resulting in mismatch in the output. I would suggest you to check the relationship between date table and other table which sometime is main cause of error or issue.
Let me know if you need further assistance on this. You may try sharing your powerbi file or some sample data to test it at our end.
- Islam
Helper V
ok i'll check it
- Islam
Helper V
I'll try it right now
- Islam
Helper V
RequiredToPay = IF([TotalExpenses]-[TotalOpenings] >0,[TotalExpenses]-[TotalOpenings])this measure is working fine but this oneTotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])give me the values without totals
- m3tr01d
Continued Contributor
With your first picture (showing Total Expenses column)
You can see that
Total Openings - Total Expenses < 0
So Total Payback si not showing because you explicitly
request Total Openigs - Total Expenses to be greather than 0TotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])- Islam
Helper V
so how should i modify or alter this measure to get the total of column
- m3tr01d
Continued Contributor
I assume you'll want the grand total to be
"The sum of all individual Total Payback value"
In this case, Let's say you have account name on the rows, you can iterate on each of them,
calculating Total Paypack, then add everything at the end.
Something like this :Total_Payback_Matrix = SUMX( VALUES( Account[Account Name] ), [Total Payback] )