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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
A_Scott
Helper I
Helper I

Matrix row total not accurately calculating

I have a matrix viual that list rows for Division/Zone/Location # and provides the percent of inspections completed.

*Current matrix visual:

A_Scott_2-1720711589697.png

 

*Current calculation for the column in question:

% Baler Complete Average =
IF(
    [Baler Count] = 0,
    "N/A",
       CALCULATE(
         MIN(1, [Completed Baler Inspections] / [Min. Baler Insp. Required])
       
    )) +0
 
*Calculation for [Baler Count]:
Baler Count = CALCULATE(
    COUNTROWS('Equip IDs'),
    FILTER('Equip IDs','Equip IDs'[Equipment Product Type Descr]="BALERS AND COMPACTORS")) +0

 

*Calculation for [Completed Baler Inspections] :

Completed Baler Inspections = CALCULATE(
    COUNTROWS('BALER_INSPECTION_LOG'))
 
*Calculation for [Min. Blaer Insp. Required]:
Min. Baler Insp. Required = [Baler Count]*7
 
*Tables 'Equip IDs' and 'BALER_INSPECTION_LOG' are linked many to many with 'Equip IDs' leading the single cross filter direction.
 
How do I make the % Baler Complete Average Total show the average of the rows and not a direct calculation of the sum of the other columns?
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @A_Scott ,

Thank you @Greg_Deckler  very much for the solution, and I've tried other ways to help you understand the problem:

You can use ISINSCOPE in DAX for contextual filtering if you want to use each row for counting and not each column.

 

% Baler Complete Average = 
IF (
   SUM('Table'[Baler Count]) = 0,
   "N/A",
   IF (
       ISINSCOPE('Table'[Location]),
       MIN(1, SUM('Table'[Completed Baler Inspections]) / SUM('Table'[Min. Baler Insp. Required])),
       AVERAGEX (
           VALUES('Table'[Location]),
           MIN(1, SUM('Table'[Completed Baler Inspections]) / SUM('Table'[Min. Baler Insp. Required]))
       )
   )
)

 

vxingshenmsft_0-1721207079883.png

Except for the % Baler Complete Average, which is all columns and does not use DAX,

you can remove my SUM function depending on the conditions and it should accomplish what you need as well.

 

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @A_Scott ,

Thank you @Greg_Deckler  very much for the solution, and I've tried other ways to help you understand the problem:

You can use ISINSCOPE in DAX for contextual filtering if you want to use each row for counting and not each column.

 

% Baler Complete Average = 
IF (
   SUM('Table'[Baler Count]) = 0,
   "N/A",
   IF (
       ISINSCOPE('Table'[Location]),
       MIN(1, SUM('Table'[Completed Baler Inspections]) / SUM('Table'[Min. Baler Insp. Required])),
       AVERAGEX (
           VALUES('Table'[Location]),
           MIN(1, SUM('Table'[Completed Baler Inspections]) / SUM('Table'[Min. Baler Insp. Required]))
       )
   )
)

 

vxingshenmsft_0-1721207079883.png

Except for the % Baler Complete Average, which is all columns and does not use DAX,

you can remove my SUM function depending on the conditions and it should accomplish what you need as well.

 

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

This worked perfectly. Thank you for your simple explination!

Greg_Deckler
Super User
Super User

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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

I've read both of those articles and still not grasping how to make it apply to my senario...

@A_Scott OK, can you post sample data.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

BALER_INSPECTION_LOG sample:

Inspection #DivisionZoneLocation #Unique Baler IDLog DateLog Time
45801101210011-00210-32512597/6/20246:13:42 AM
45901101210011-00210-32595347/6/20246:14:16 AM
46001101469011-00469-32803517/6/20246:32:22 AM
46101101426011-00426-33020777/6/20246:34:19 AM
46201101210011-00210-32512597/6/20247:32:14 AM
46301101441011-00441-32756037/6/20247:46:01 AM
46401101469011-00469-32803517/6/20248:36:08 AM
46501101390011-00390-32684267/6/20248:42:18 AM
46601101390011-00390-32684257/6/20248:47:43 AM
46701101469011-00469-42019677/6/20248:48:06 AM
46801101381011-00381-32684277/6/20249:06:06 AM
46901101437011-00437-32683627/6/20249:09:50 AM
47001101467011-00467-32646107/6/20249:42:13 AM
47101101653011-00653-32980437/6/20249:52:13 AM
47201101653011-00653-32980437/6/20249:52:23 AM
47301101441011-00441-32756037/6/202410:32:57 AM
47401101486011-00486-32708027/6/202411:18:07 AM
47501101434011-00434-32684287/6/202412:39:47 PM
47601101437011-00437-32683627/6/202412:57:02 PM

 

Equip IDs sample:

DivisionZoneLocation #Unique Equip IDEquipment Product Type Descr
01101210011-00210-3251259BALERS AND COMPACTORS
01101324011-00324-3268432BALERS AND COMPACTORS
01101344011-00344-3262636BALERS AND COMPACTORS
01101381011-00381-3268427BALERS AND COMPACTORS
01101390011-00390-3268425BALERS AND COMPACTORS
01101390011-00390-3268426BALERS AND COMPACTORS
01101426011-00426-3302077BALERS AND COMPACTORS
01101434011-00434-3268428BALERS AND COMPACTORS
01101437011-00437-3268362BALERS AND COMPACTORS
01101441011-00441-3275603BALERS AND COMPACTORS
01101467011-00467-3264610BALERS AND COMPACTORS
01101469011-00469-3280351BALERS AND COMPACTORS
01101473011-00473-3269449BALERS AND COMPACTORS
01101486011-00486-3270802BALERS AND COMPACTORS
01101653011-00653-3298043BALERS AND COMPACTORS
01101682011-00682-3255094BALERS AND COMPACTORS
01101682011-00682-3255121BALERS AND COMPACTORS
01101687011-00687-3259870BALERS AND COMPACTORS

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.