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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello everyone,
I need a method in Power BI to dynamically adjust values in Row A so that its total matches Row B (139). Key requirements:
Example Data Structure:
| 01/25 | 02/25 | 03/25 | 04/25 | 05/25 | 06/25 | 07/25 | 08/25 | 09/25 | 10/25 | 11/25 | 12/25 | TT | |
A | Nb days projet | 8 | 14 | 17 | 15 | 14 | 10 | 5 | 4 | 17 | 18 | 12 | 12 | 146 |
B | Nb days projet cible | 10 | 12 | 15 | 13 | 14 | 11 | 9 | 8 | 12 | 13 | 12 | 10 | 139 |
C | MAX | 11 | 12 | 17 | 16 | 16 | 12 | 11 | 11 | 13 | 15 | 13 | 13 | 160 |
Goal:
Automatically adjust Row A’s values (per column) to ensure:
Solved! Go to Solution.
A big thank you for your time and help.
I had to make a small modification to make it work:
_________________________________________________________________
Adjusted_Nb_Days_Projet =
VAR SumA = SUM('Table'[Nb days projet])
VAR SumB = SUM('Table'[Nb days projet cible])
VAR AdjustmentFactor = IF(SumA = 0, 1, SumB / SumA)
VAR RawAdjusted = SUM('Table'[Nb days projet] )* AdjustmentFactor
VAR MaxAllowed = SUM('Table'[MAX])
VAR AdjustedValues = MIN(RawAdjusted, MaxAllowed)
VAR TotalAdjusted = SUMX(FILTER('Table'[Nb days projet]), AdjustedValues)
VAR RemainingGap = SumB - TotalAdjusted
VAR PerColumnCorrection = RemainingGap / COUNTROWS(ALL('Table'))
RETURN
MIN(AdjustedValues + PerColumnCorrection, SUM('Table'[MAX]))
_________________________________________________________________
I hadn’t considered one thing—that months already passed or in progress are also being modified, and this must be locked by the input.
Is there a possibility for this formula to apply to the remaining months while taking into account the values entered for past and current months? In our example, this would apply from March to December.
If you still have a little time to spare for me, that would be great!
Hello @microdri,
Can you please try this approach:
Adjusted_Nb_Days_Projet =
VAR SumA = SUM('Table'[Nb days projet])
VAR SumB = SUM('Table'[Nb days projet cible])
VAR AdjustmentFactor = IF(SumA = 0, 1, SumB / SumA)
VAR RawAdjusted = 'Table'[Nb days projet] * AdjustmentFactor
VAR MaxAllowed = 'Table'[MAX]
VAR AdjustedValues = MIN(RawAdjusted, MaxAllowed)
VAR TotalAdjusted = SUMX(ALL('Table'), AdjustedValues)
VAR RemainingGap = SumB - TotalAdjusted
VAR PerColumnCorrection = RemainingGap / COUNTROWS(ALL('Table'))
RETURN
MIN(AdjustedValues + PerColumnCorrection, 'Table'[MAX])
A big thank you for your time and help.
I had to make a small modification to make it work:
_________________________________________________________________
Adjusted_Nb_Days_Projet =
VAR SumA = SUM('Table'[Nb days projet])
VAR SumB = SUM('Table'[Nb days projet cible])
VAR AdjustmentFactor = IF(SumA = 0, 1, SumB / SumA)
VAR RawAdjusted = SUM('Table'[Nb days projet] )* AdjustmentFactor
VAR MaxAllowed = SUM('Table'[MAX])
VAR AdjustedValues = MIN(RawAdjusted, MaxAllowed)
VAR TotalAdjusted = SUMX(FILTER('Table'[Nb days projet]), AdjustedValues)
VAR RemainingGap = SumB - TotalAdjusted
VAR PerColumnCorrection = RemainingGap / COUNTROWS(ALL('Table'))
RETURN
MIN(AdjustedValues + PerColumnCorrection, SUM('Table'[MAX]))
_________________________________________________________________
I hadn’t considered one thing—that months already passed or in progress are also being modified, and this must be locked by the input.
Is there a possibility for this formula to apply to the remaining months while taking into account the values entered for past and current months? In our example, this would apply from March to December.
If you still have a little time to spare for me, that would be great!