Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RENJITH_R_S
Resolver II
Resolver II

Matrix Visual Total Wrong

Hello Friends, Can you help me on this issue. I have 2 measures actuals and forecast and 2 columns cost and fiscal year. I want to visual a matrix with this data with a condition for fiscal year 2024 actuals needs to show and for others forecast. see the below screenshot . I have created new measure 

IF(SELECTEDVALUE('Calendar'[Fiscal Year])=2024,[Actuals],[forecast]) in the values it is working correct but in the total part calcualtion is not working. total picks the forecast value for 2024. please help on this

 

RENJITH_R_S_0-1747205552001.png

 

1 ACCEPTED SOLUTION
RENJITH_R_S
Resolver II
Resolver II

I got the answer
Result = 

var a = CALCULATE([Actuals],FILTER('Calendar','Calendar'[Fiscal Year]=2024))

var b = CALCULATE([Forecsst],FILTER('Calendar','Calendar'[Fiscal Year]<>2024))

var c = a+b

return c

View solution in original post

3 REPLIES 3
RENJITH_R_S
Resolver II
Resolver II

I got the answer
Result = 

var a = CALCULATE([Actuals],FILTER('Calendar','Calendar'[Fiscal Year]=2024))

var b = CALCULATE([Forecsst],FILTER('Calendar','Calendar'[Fiscal Year]<>2024))

var c = a+b

return c

GrowthNatives
Solution Specialist
Solution Specialist

Hi @RENJITH_R_S , this issue you're facing is a classic DAX total vs. row context problem in Power BI. Your current measure using:

IF(SELECTEDVALUE('Calendar'[Fiscal Year]) = 2024, [Actuals], [Forecast])

works for individual fiscal years in the row context, but fails at the total level because SELECTEDVALUE('Calendar'[Fiscal Year]) returns blank when multiple years are in context (like in the Total row), so it defaults to [Forecast].
What we need:

  • Show [Actuals] only for 2024
  • Use [Forecast] for all other years
  • Ensure the total reflects this mixed logic

Fix: Use SUMX over Years

Instead of relying on SELECTEDVALUE which fails in totals, use SUMX to evaluate row-wise logic:

Final Cost = 
SUMX(
    VALUES('Calendar'[Fiscal Year]),
    IF(
        'Calendar'[Fiscal Year] = 2024,
        [Actuals],
        [Forecast]
    )
)

🔍 Explanation:

  • VALUES('Calendar'[Fiscal Year]) gets a list of individual years (even in the Total row).

  • SUMX(...) iterates over each year and applies your logic.

  • It adds [Actuals] for 2024 and [Forecast] for other years.

Now this will show correct values in the matrix cells & accurate total (1 + 2 + 1 + 1 + 1 = 6)

Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀

@GrowthNatives - Thanks for the response. As per your formula, only actuals means fiscal year 2024 data is showing. no other years are showing

RENJITH_R_S_0-1747209996875.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.