Forum Discussion
geirselvag
1 year agoFrequent Visitor
DAX help - distributed sum
Hello folks, The DAX requirements I'm faced with is include to be able to distribute project cost (or settlement) to other project based on precentage. The basis for DAX is two tables one dim_WBS...
- Anonymous1 year ago
Hi geirselvag
Sorry for the late reply.
Try to update the measure with the following DAX:
Cost_Distributed_Measure = SUMX( fact_COST, VAR CurrentWBS = fact_COST[WBS] VAR CurrentCOST = fact_COST[Cost] VAR NewWBS = IF( ISBLANK(LOOKUPVALUE(dim_WBS[Settlement_WBS], dim_WBS[WBS], CurrentWBS)), CurrentWBS, LOOKUPVALUE(dim_WBS[Settlement_WBS], dim_WBS[WBS], CurrentWBS) ) VAR OriginalCost = CALCULATE( SUM(fact_COST[Cost]), fact_COST[WBS] = NewWBS, REMOVEFILTERS(fact_COST) ) VAR Distributed = OriginalCost * LOOKUPVALUE(dim_WBS[Percent], dim_WBS[WBS], CurrentWBS) RETURN IF(ISBLANK(Distributed), 0, Distributed + CurrentCOST) )Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - 1 year ago
This is excellent work.
Thank you!
Kind regards,
Geir
Anonymous
1 year agoNot applicable
Hi geirselvag
Sorry for the late reply.
Try to update the measure with the following DAX:
Cost_Distributed_Measure =
SUMX(
fact_COST,
VAR CurrentWBS = fact_COST[WBS]
VAR CurrentCOST = fact_COST[Cost]
VAR NewWBS = IF(
ISBLANK(LOOKUPVALUE(dim_WBS[Settlement_WBS], dim_WBS[WBS], CurrentWBS)),
CurrentWBS,
LOOKUPVALUE(dim_WBS[Settlement_WBS], dim_WBS[WBS], CurrentWBS)
)
VAR OriginalCost = CALCULATE(
SUM(fact_COST[Cost]),
fact_COST[WBS] = NewWBS,
REMOVEFILTERS(fact_COST)
)
VAR Distributed = OriginalCost * LOOKUPVALUE(dim_WBS[Percent], dim_WBS[WBS], CurrentWBS)
RETURN
IF(ISBLANK(Distributed), 0, Distributed + CurrentCOST)
)
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
geirselvag
1 year agoFrequent Visitor
This is excellent work.
Thank you!
Kind regards,
Geir