Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
I am performing a calculation where the values are being accumulated according to the ranking position (from the highest value, to the lowest), using rankx for this.
However when there are negative values, it is not adding to the calculation.
Does anyone know how to fix it?
Below, the code I'm doing:
_SomaValorReal = SUM(fRealizado[Valor]) -- MEASURE1
_RankingGeralReal = RANKX(ALLSELECTED(dCentroDeCustoDW),[_SomaValorReal]) -- MEASURE2
_AcumuladoReal =
var contextoR = [_RankingGeralReal]
var fatacumR =
CALCULATE(
[_SomaValorReal],
FILTER(
ALL(dCentroDeCustoDW),
[_RankingGeralReal] <= contextoR
)
)
RETURN
fatacumR
And in the image below, the (wrong) form that the calculation returns:
Solved! Go to Solution.
in third measure "_AcumuladoReal " there is reference to second measure _RankingGeralReal which use ALLSELECTED funtion.
When one measure call another measure with ALLSELECTED, then results are almost impossible to understand / spot cause for unlogical amounts. The best practice for ALLSELECTED is to use it for single visual, not chain measure with ALLSELECTED to another measure.
You will need to rework your measure.
One possible solution could be that you create VAR in third measure with definition of second measure. So test this approach and see results.
Proud to be a Super User!
Thank you very much,
I replaced "allselected" by "all", and in the context of what I wanted, it worked
in third measure "_AcumuladoReal " there is reference to second measure _RankingGeralReal which use ALLSELECTED funtion.
When one measure call another measure with ALLSELECTED, then results are almost impossible to understand / spot cause for unlogical amounts. The best practice for ALLSELECTED is to use it for single visual, not chain measure with ALLSELECTED to another measure.
You will need to rework your measure.
One possible solution could be that you create VAR in third measure with definition of second measure. So test this approach and see results.
Proud to be a Super User!
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 47 | |
| 29 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 90 | |
| 74 | |
| 40 | |
| 26 | |
| 25 |