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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
thomazinh
Helper I
Helper I

DAX AVERAGEX total result not expected in matrix

I have a matrix where I'm sumarizing by Project and Discipline. The Adjusted Bid Factor values in the Matrix are reading from different What If sliders and displaying those selected results at the row level. I want the Totals in the Matrix to show the average value at Project 1 and Project 2 and finally for the Total. 

 

I expect Project 1's total to be 0.75. Project 2 to be 1.0, and the Total row to be 0.88.

 

thomazinh_1-1659453535447.png

 

Below is my sample code displaying the Adjusted Bid Factor column using the AVERAGEX

_Bid Factor (Selected) AVGX = 
//AVERAGEX('WbsCode Forecast',[_Bid Factor (Selected)])
IF ( HASONEFILTER('WbsCode Forecast'[WbsCode.Discipline.name] ), 
    'WbsCode Forecast'[_Bid Factor (Selected)],
    IF( 
        HASONEFILTER(Jobs[JobName] ),
        AVERAGEX('WbsCode Forecast', 'WbsCode Forecast'[_Bid Factor (Selected)]),
        CALCULATE(
            AVERAGEX( ALLSELECTED(Jobs[JobName] ), 'WbsCode Forecast'[_Bid Factor (Selected)])
        )
    )
)

 

Below is my Bid Factor Selected DAX,

_Bid Factor (Selected) = 
// Pre-req DAX for the _Bid Factor (Selected) AVGX measure. 
// Displays the What If selected value for each of the corresponding Disciplines
VAR ShowSelected = 
    SWITCH( TRUE(),
        CONTAINSSTRING( SELECTEDVALUE('WbsCode Forecast'[WbsCode.Discipline.name]),"PLI"), SELECTEDVALUE('PLI Bid Factor'[PLI Bid Factor]),
        CONTAINSSTRING( SELECTEDVALUE('WbsCode Forecast'[WbsCode.Discipline.name]),"PLF"), SELECTEDVALUE('PLF Bid Factor'[PLF Bid Factor]),
        CONTAINSSTRING( SELECTEDVALUE('WbsCode Forecast'[WbsCode.Discipline.name]),"PFI"), SELECTEDVALUE('PFI Bid Factor'[PFI Bid Factor]),
        CONTAINSSTRING( SELECTEDVALUE('WbsCode Forecast'[WbsCode.Discipline.name]),"PFF"), SELECTEDVALUE('PFF Bid Factor'[PFF Bid Factor]),
        CONTAINSSTRING( SELECTEDVALUE('WbsCode Forecast'[WbsCode.Discipline.name]),"SMI"), SELECTEDVALUE('SMI Bid Factor'[SMI Bid Factor]),
        CONTAINSSTRING(SELECTEDVALUE('WbsCode Forecast'[WbsCode.Discipline.name]),"SMF"), SELECTEDVALUE('SMF Bid Factor'[SMF Bid Factor]),
    1
)
Var Result = 
    IF(ISINSCOPE('WbsCode Forecast'[WbsCode.Discipline.name]),ShowSelected,0) //Displays the rollup value for the Bid Factor starting at the WBS level
Return
 Result 

 

Can someone help me remedy the Total values in the matrix to show the average instead of what it currently is? 

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@thomazinh 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, this may come in handy as well, MM3TR&R: Matrix Measure Total Triple Threat Rock & Roll - Microsoft Power BI Community



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.