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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Weighted Average dax measure - Totals are incorrect

I have a matrix that looks like this:

WIP is just a total on WIP from a transaction.

Age is a column which states the age of the wip

Total WIP is used in the calculation

WIP Percent Calculates the WIP to total WIP        (WIP  * total WIP)

Weighted Aged Days: Calculates with the following (WIP Percent) * Age. However in the Matter and Client totals of the Matrix the Total is around 200 when it should be 23.

 

Measure i am using for Weighted Aged Days:


Measure_Total_Aged_Days =
var TotalWIP = Calculate(Sum(WIPHistory[WIP]),ALLSELECTED(WIPHistory[Alloc_ID]))
Var WIP= Calculate(Sum(WIPHistory[WIP]))
var WipAge= [Aged Days]
var Complete = (DIVIDE(WIP,TotalWIP ,0) * WipAge)

return
IF (
HASONEVALUE ( WIPHistory[CLIENT_ID] ),
Complete,
SUMX ( ALLSELECTED (WIPHistory[CLIENT_ID] ),Complete )
)

Is it an issue with my Measure? any help at all would be amazing.

 

Client ID/MatterID/TranWIPAgeTotal WIPWIP PercentWeighted Aged Days
4310060100100%200 (WRONG TOTAL)
4651010060100100%200
551503010050%15
552302010030%6
553302010020%2
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI @Anonymous 

This is a measure totals problem. you may add another measure as below:

Measure =
VAR _table =
    SUMMARIZE (
        WIPHistory,
        WIPHistory[Client ID],
        WIPHistory[MatterID],
        WIPHistory[Tran],
        "_Value", [Measure_Total_Aged_Days]
    )
RETURN
    SUMX ( _table, [_Value] )

If you still have the problem, please share a simple sample pbix file, that will be a great help.

 

Regards,

Lin

Community Support Team _ Lin
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
v-lili6-msft
Community Support
Community Support

HI @Anonymous 

This is a measure totals problem. you may add another measure as below:

Measure =
VAR _table =
    SUMMARIZE (
        WIPHistory,
        WIPHistory[Client ID],
        WIPHistory[MatterID],
        WIPHistory[Tran],
        "_Value", [Measure_Total_Aged_Days]
    )
RETURN
    SUMX ( _table, [_Value] )

If you still have the problem, please share a simple sample pbix file, that will be a great help.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

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


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I am currently using Sumx and HasOneValue and the calculation still does not total correctly.

Right, but you are probably not summarizing it the same way that you are in the table visualization so it likely comes out wrong. Or it could be an issue with your measure the way you have written it since it is in an individual row.

 

Tough to say without sample source data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank you! i will look into this summerize function.

Anonymous
Not applicable

What i have tried:

var total2 = sumx(WIPHistory,[Aged Days]) * (SUMX(WIPHistory,WIPHistory[WIP]) / Calculate(SumX(WIPHistory,[WIP]),ALLSELECTED(WIPHistory[Alloc_ID])))

var a = SUMX(SUMMARIZE(WIPHistory,WIPHistory[Alloc_ID],"b",total2),[b])
return

IF (
HASONEVALUE ( WIPHistory[Alloc_ID] ),
a,
SUMX ( ALLSELECTED (WIPHistory[Alloc_ID] ),a )
)
 
This gets the correct row level but the totals are still out. I will continue to try get this totalled and post updates

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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