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
brankocareer
Helper I
Helper I

Total value is not right in Matrix table

Hi all,

I need some hlep to calculate the total in a matrix table. When calculte each category, the condition applied is different. When calculate "SALARIES", the [Document Type] must to be "PY", for oter category, there is no such limit. I write the measure like this:

APR =
VAR CurrenPeriod = CALCULATE(MAX('Date'[Period]), 'Date'[Date]=TODAY())
VAR SalaryForecast = [Salary Filled Position]
VAR ActualValue =
IF(MAX('Rollup Master'[Rollup for Forecast Account Category])="SALARIES",
CALCULATE(SUM('G/L Account'[Amount]), 'Date'[Period]=1,'G/L Account'[Document Type]="PY"),
CALCULATE(SUM('G/L Account'[Amount]), 'Date'[Period]=1))

RETURN
IF(CurrenPeriod>1, ActualValue, SalaryForecast)

brankocareer_1-1727370420219.png

 

The total value 112,465 is the value without any limit. Please help how to revise the measure.

 

Thank you in advance!

Branko

Rollup for Forecast Account CategoryAccount Rollup for Corporate ReportSum of AmountDocument Type
SALARIESSalaries72331PY
SALARIESSalaries34727SA
SUPPLIESEmployee Travel3720AC
SUPPLIESEmployee Travel-10112AD
SUPPLIESEmployee Travel10278TV
SUPPLIESContract Services472SA
SUPPLIESMaterials & Supplies100AC
SUPPLIESMaterials & Supplies680KR
SUPPLIESOther106KR
SUPPLIESOther163WE

 

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

lbendlin_0-1727391387677.png

APR = 
var a = SUMMARIZE('Rollup Master',[Rollup for Forecast Account Category],[Account Rollup for Corporate Report],[Document Type])
var b = ADDCOLUMNS(a, "amt",CALCULATE(sum('Rollup Master'[Amount])))
return sumx(filter(b,[Document Type]="PY" || [Rollup for Forecast Account Category]<>"SALARIES"),[amt])

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @brankocareer ,

 

Did Ibendlinreply solve your problem? If so, please mark it as the correct solution, and point out if the problem persists.

 

Best Regards,
Adamk Kong

lbendlin
Super User
Super User

lbendlin_0-1727391387677.png

APR = 
var a = SUMMARIZE('Rollup Master',[Rollup for Forecast Account Category],[Account Rollup for Corporate Report],[Document Type])
var b = ADDCOLUMNS(a, "amt",CALCULATE(sum('Rollup Master'[Amount])))
return sumx(filter(b,[Document Type]="PY" || [Rollup for Forecast Account Category]<>"SALARIES"),[amt])

 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.