Forum Discussion
In a Matrix hierarchy, alter one node to a desired value
- Anonymous2 years ago
Hi Petr_M ,
Use the All function to ignore any filters that might have been applied during calculatedenominator.
MeasureTotal =
VAR Denominator=CALCULATE([RWA Digit Actual],
FILTER(
ALL('digit_database'),
'digit_database'[NWU]= "B" && 'digit_database'[RWA_TYPE] = "X"
))
VAR Ratio = 24/Denominator
VAR TotalSales=SUMX(
SUMMARIZE(
digit_database,
digit_database[NWU],digit_database[RWA_TYPE],
"CalculatedValue",
IF(
SELECTEDVALUE(digit_database[NWU]) = "B",
SWITCH(digit_database[RWA_TYPE],"X",
SUMX(
FILTER(digit_database, digit_database[NWU] = "B" ),
[RWA Digit Actual] * Ratio
),[RWA Digit Actual]),
SUMX(
FILTER(digit_database, digit_database[NWU] <> "B"),
[RWA Digit Actual]
)
)
),
[CalculatedValue]
)
RETURN TotalSales
Another simple measure for your reference:
Measure =VAR Denominator = CALCULATE([RWA Digit Actual],FILTER(ALL('digit_database'),'digit_database'[NWU] = "B" && 'digit_database'[RWA_TYPE] = "X"))VAR Ratio = 24 / DenominatorRETURN SUMX(ADDCOLUMNS(digit_database,"CalculatedValue",IF([NWU] = "B" && [RWA_TYPE] = "X",[RWA Digit Actual] * Ratio,[RWA Digit Actual])),[CalculatedValue])
Result:
Best regards,Joyce
If this post helps, then please considerAccept it as the solution to help the other members find it more quickly.
Hi Petr_M ,
Thank you for your reply and if possible, please upload your pbix example file so we can better test it for you.
Sorry for the delay in getting back to you! I had some busy days and had to strip my pbix of useless and confidential data.
On the right, there is your working example.
On the left, I'm attempting to replicate it in a more complex scenario. I have a digit_database fact table with three months. I choose the Actual month and want to display the original data (Act) and the Result which has the value of B/X node and its children normalized to given B/X sum.
I have different hierarchy level names (UNIT, RWA_TYPE, Segment1) and the hierarchy is defined outside of the fact table. So far, I was unable to figure this out.
- Anonymous2 years agoNot applicable
Hi Petr_M ,
Thank you for your sample pbix file, please try following measure to check the result:MeasureTotal = VAR Denominator=CALCULATE([RWA Digit Actual], FILTER( 'digit_database', 'digit_database'[NWU]= "B" && 'digit_database'[RWA_TYPE] = "X" )) VAR Ratio = 24/Denominator VAR TotalSales=SUMX( SUMMARIZE( digit_database, digit_database[NWU],digit_database[RWA_TYPE], "CalculatedValue", IF( SELECTEDVALUE(digit_database[NWU]) = "B", SWITCH(digit_database[RWA_TYPE],"X", SUMX( FILTER(digit_database, digit_database[NWU] = "B" ), [RWA Digit Actual] * Ratio ),[RWA Digit Actual]), SUMX( FILTER(digit_database, digit_database[NWU] <> "B"), [RWA Digit Actual] ) ) ), [CalculatedValue] ) RETURN TotalSalesBest regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Petr_M2 years agoFrequent Visitor
Thank you, I really appreciate the time you put into this. That's some advanced stuff, I wouldn't be able to come up with.
At a first glance, however, the desired B/X sum seems to be 24.09 rather than 24.00. And the[RWA Digit Actual] * 3
part looks a bit suspicious to me.
- Anonymous2 years agoNot applicable
Petr_M ,
Sorry for forgetting to change the test data, I've updated the above reply to the correct version.Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.