Forum Discussion
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
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
3 Replies
- GrowthNativesSuper User
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! π- RENJITH_R_SResolver II
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_SResolver 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