Forum Discussion
EnrichedUser
Helper III
4 years agoIncorrect Totals - Matrix
Good Day! I think I have a rather complex situation and would greatly apprecaite some help. Specifically, I am not able to correctly determine the row, column or grand totals at the 'Site' l...
- 4 years ago
Customer Inflation with Fixed Totals = VAR vTable = ADDCOLUMNS( SUMMARIZE('Invoice History', 'Date'[Fiscal Year Number], 'Date'[Month], 'Invoice History'[Site], 'Invoice History'[Item Number] ), "@inflation", [Customer Inflation] ) VAR TotalInflation = SWITCH( TRUE(), HASONEVALUE('Date'[Month]) && HASONEVALUE('Invoice History'[Item Number]), [Customer Inflation], // Base data HASONEVALUE('Date'[Month]), CALCULATE( SUMX( vTable, [@inflation] ) ), // column totals, HASONEVALUE('Invoice History'[Item Number]), // row totals CALCULATE( SUMX( vTable, [@inflation] ), VALUES('Date'[Month]) ), // grand total SUMX( vTable, [@inflation] ) ) RETURN TotalInflationWorking solution
EnrichedUser
Helper III
4 years agoCustomer Inflation with Fixed Totals =
VAR vTable =
ADDCOLUMNS(
SUMMARIZE('Invoice History',
'Date'[Fiscal Year Number],
'Date'[Month],
'Invoice History'[Site],
'Invoice History'[Item Number]
),
"@inflation", [Customer Inflation]
)
VAR TotalInflation =
SWITCH(
TRUE(),
HASONEVALUE('Date'[Month]) && HASONEVALUE('Invoice History'[Item Number]),
[Customer Inflation], // Base data
HASONEVALUE('Date'[Month]),
CALCULATE(
SUMX( vTable,
[@inflation]
)
), // column totals,
HASONEVALUE('Invoice History'[Item Number]), // row totals
CALCULATE(
SUMX(
vTable,
[@inflation]
),
VALUES('Date'[Month])
), // grand total
SUMX(
vTable,
[@inflation]
)
)
RETURN
TotalInflationWorking solution