This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreGet Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.
Hi Team,
I am writing a simple measure with if condition
if avg fin < avg current fin then sum of Inv_Inv else running total of Inv_Nation, with the below measure my output are correct but my total is not correct.
Measure :
| 82,20,50,276.81 |
PowerBi OutPut
Thanks in advance !
Solved! Go to Solution.
@Anonymous , Try like
Inventory_Result_Calculation_Year =
VAR AvgFISCPER = AVERAGE('src_horizon v_horizon_aggregate'[FISCPER])
VAR AvgCurrentFISCPER = AVERAGE('src_horizon v_horizon_aggregate'[CURRENT_FISCPER])
VAR MaxYear = MAX('src_horizon v_horizon_aggregate'[YEAR])
VAR MaxMonthNumber = MAX('src_horizon v_horizon_aggregate'[Month_Number])
VAR MaxWeek = MAX('src_horizon v_horizon_aggregate'[WEEK])
VAR MaxProductGroup = MAX('src_horizon v_horizon_aggregate'[PRODUCT_GROUP])
VAR Result =
IF(
AvgFISCPER < AvgCurrentFISCPER,
SUM('src_horizon v_horizon_aggregate'[ACT_INV]),
BLANK()
)
RETURN
CALCULATE(
SUM('src_horizon v_horizon_aggregate'[INVENTORY_NATIONAL]),
FILTER(
ALLSELECTED('src_horizon v_horizon_aggregate'),
'src_horizon v_horizon_aggregate'[YEAR] <= MaxYear
),
ALL('src_horizon v_horizon_aggregate'),
Result
)
@Anonymous , Try like
Inventory_Result_Calculation_Year =
VAR AvgFISCPER = AVERAGE('src_horizon v_horizon_aggregate'[FISCPER])
VAR AvgCurrentFISCPER = AVERAGE('src_horizon v_horizon_aggregate'[CURRENT_FISCPER])
VAR MaxYear = MAX('src_horizon v_horizon_aggregate'[YEAR])
VAR MaxMonthNumber = MAX('src_horizon v_horizon_aggregate'[Month_Number])
VAR MaxWeek = MAX('src_horizon v_horizon_aggregate'[WEEK])
VAR MaxProductGroup = MAX('src_horizon v_horizon_aggregate'[PRODUCT_GROUP])
VAR Result =
IF(
AvgFISCPER < AvgCurrentFISCPER,
SUM('src_horizon v_horizon_aggregate'[ACT_INV]),
BLANK()
)
RETURN
CALCULATE(
SUM('src_horizon v_horizon_aggregate'[INVENTORY_NATIONAL]),
FILTER(
ALLSELECTED('src_horizon v_horizon_aggregate'),
'src_horizon v_horizon_aggregate'[YEAR] <= MaxYear
),
ALL('src_horizon v_horizon_aggregate'),
Result
)
Hi!
Did you fix the problem?
If not, you should consider providing some sample data so that it is easier to debug what may cause problems.
Kind regards
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 21 | |
| 21 | |
| 21 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 56 | |
| 53 | |
| 49 | |
| 26 | |
| 25 |