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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Islam
Helper V
Helper V

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

16114831148347741769115777909226.jpg

1 ACCEPTED SOLUTION

@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:


TotalPayback New =
var _filterArea = FILTER('Table','Table'[Openings]>'Table'[Expenses])
RETURN
IF(HASONEVALUE('Table'[YearMonth]),
IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses]),
SUMX(_filterArea,'Table'[Openings]-'Table'[Expenses])
)
matrix total.PNG
 
Regards,
Nemanja Andic

Attached file.

View solution in original post

22 REPLIES 22
m3tr01d
Continued Contributor
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]
)
m3tr01d
Continued Contributor
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 0 

TotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])

 

so how should i modify or alter this measure to get the total of column

 

negi007
Community Champion
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. 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

RequiredToPay = IF([TotalExpenses]-[TotalOpenings] >0,[TotalExpenses]-[TotalOpenings])
this measure is working fine but this one
TotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])
give me the values without totals

I'll try it right now

 

ok i'll check it

m3tr01d
Continued Contributor
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

RequiredToPay = IF([TotalExpenses]-[TotalOpenings] >0,[TotalExpenses]-[TotalOpenings])
this measure is working fine but this one
TotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])
give me the values without totals
nandic
Super User
Super User

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

RequiredToPay = IF([TotalExpenses]-[TotalOpenings] >0,[TotalExpenses]-[TotalOpenings])
this measure is working fine but this one
TotalPayback = IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses])
give me the values without totals
that's the problem and i don't know what is the problem here

@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

weird I found that the total of those two measures 

requiredtopay and totalpayback is subtracted from each others and total is the net value

 

Sure here all info u need16114996554838141862883158939153.jpg

16114998883883692268500460206931.jpg

1611499907827371527084819333067.jpg

  

16114999702534884434770801854350.jpg

@m3tr01d  @negi007 

watch this

@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:


TotalPayback New =
var _filterArea = FILTER('Table','Table'[Openings]>'Table'[Expenses])
RETURN
IF(HASONEVALUE('Table'[YearMonth]),
IF([TotalOpenings]-[TotalExpenses] >0,[TotalOpenings]-[TotalExpenses]),
SUMX(_filterArea,'Table'[Openings]-'Table'[Expenses])
)
matrix total.PNG
 
Regards,
Nemanja Andic

Attached file.

excuse me sir can i send u the pbix file ?

Yes, you can send the file and i will take i look.

how can i attach file ?

Anyway I'll check if i can do it myself and if so I'll let you know

Really appreciate it sir

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors
Top Kudoed Authors