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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
raju8004212
Frequent Visitor

Totals not matching in matrix visual

PTO/Headcount (Current Yr) =

VAR MAXM = MAX(W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM])
VAR FY = MAX(W_MCAL_PERIOD_D[MCAL_YEAR])
VAR dates = FILTER('W_MCAL_PERIOD_D Duplicate', 'W_MCAL_PERIOD_D Duplicate'[MCAL_JULIAN_PERIOD_NUM] <=MAXM && 'W_MCAL_PERIOD_D Duplicate'[MCAL_YEAR] = FY )
VAR count_weeks = max('W_MCAL_PERIOD_D Duplicate'[MCAL_PERIOD_TOTAL_WEEKS])
VAR calc1 =
    Calculate(WC_GL_GA_BILL_F[Vacation Hours],
    REMOVEFILTERS(W_MCAL_PERIOD_D),
    KEEPFILTERS(dates),
    USERELATIONSHIP(W_MCAL_PERIOD_D[ROW_WID],'W_MCAL_PERIOD_D Duplicate'[ROW_WID])
    )

var calc2 =
    CALCULATE(SUM(WC_GL_GA_BILL_F[TOTAL_HOURS])/40,
    REMOVEFILTERS(W_MCAL_PERIOD_D),
    KEEPFILTERS(dates),
    USERELATIONSHIP(W_MCAL_PERIOD_D[ROW_WID],'W_MCAL_PERIOD_D Duplicate'[ROW_WID]),
    W_MCAL_PERIOD_D[MCAL_CAL_WID] = 1011

    )

Return IFERROR(calc1/calc2,0)*count_weeks

by using above calculation in matrix visual im not able to get correct total after enabling row totals 
raju8004212_0-1740653620176.png

 



can any one help me on this
1 REPLY 1
freginier
Super User
Super User

Hey there!

 

You can try to modify your DAX formula for the total row calculation by using a conditional check. Power BI's behavior when calculating totals can be different, so you might need to manually adjust the logic when calculating for the total.

For example, you can use something like:

TotalCalc =
IF(
HASONEVALUE(W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM]),
[YourRegularCalculation], -- regular formula for individual values
SUMX(ALL(W_MCAL_PERIOD_D), [YourRegularCalculation]) -- aggregate total calculation
)

 

This approach ensures that when you're at the row level (single period), it uses your regular calculation, but when you're calculating totals, it sums across all rows using the ALL function.

 

Hope this helps!

😁😁

‌‌‌‌

 


‌‌‌‌

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors