The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a matrix where I am expecting to get an average value for the Total rows in the Adjusted Bid Factor column.
The Adjusted Bid Factor column is using a What If value that I'm referencing called _Bid Factor (Selected). The matrix row structure is (lowest to highest) Discipline Name to Project Name. I tried using HASONEFILTER but was unsuccessful. I'm doing something similar with SUMX on Forecasted Actual Cost and have no issues.
On the above matrix, I would expect the top total for the Project to be the 0.75 (=(1.00+0.50)/2) but it is returning 0.63. For the Total row, I would expect 0.88 (=(1.0+1.0+1.0+0.5)/4).
The _Bid Factor (Selected) DAX doesn't give me any issues,
_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
Below is what I have for the _Bid Facotr (Selected) AVGX DAX,
_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 similar code for the Forecasted Actual Cost column,
_Productive Labor Field (Forecasted Actual Cost) SUMX =
IF (
HASONEFILTER ( 'WbsCode Forecast'[WbsCode.Discipline.display] ),
[_Productive Labor Field (Forecasted Actual Cost)],
IF (
HASONEFILTER ( Jobs[JobName] ),
[_Productive Labor Field (Forecasted Actual Cost)],
CALCULATE (
SUMX (
ALLSELECTED ( Jobs[JobName] ),
[_Productive Labor Field (Forecasted Actual Cost)]
)
)
)
)
Is there a way to calculate the avereage for the Adjusted Bid Factor column?
Hi @thomazinh
Can you mock up some dummy data and paste it here so that we can use it for testing the measures? Which tables are involved in this matrix? Can you elaborate the relationships between them?https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Best Regards,
Community Support Team _ Jing