Forum Discussion
EnrichedUser
3 years agoHelper III
Incorrect Totals: - Matrix
Hi, I have an issue with a measure(s) that I have exhuasted all other resources to solve. I am trying to solve for "Monthly Inflation" which is defined as: ( [Last Unit Cost] - [Base Unit C...
EnrichedUser
3 years agoHelper III
I have made significant progress, but am not seeing the totals sum up correctly for the year month now.
Monthly Inflation (TEST2) =
VAR VirtualTable =
ADDCOLUMNS(
SUMMARIZE(
GENERATE(
VALUES(Receipts[Site_Item_Key]),
VALUES('Date'[Year Month])
),
Receipts[Site_Item_Key],
'Date'[Year Month]
),
"@Monthly Inflation", [Monthly Inflation (R)]
)
VAR VirtualTable2 =
ADDCOLUMNS(
SUMMARIZE(
GENERATE(
VALUES(Receipts[Site_Item_Key]),
VALUES('Date'[Year Month])
),
Receipts[Site_Item_Key],
'Date'[Year Month]
),
"@Monthly Inflation", [Monthly Inflation (R)]
)
RETURN
SWITCH(
TRUE(),
ISINSCOPE( Receipts[Site_Item_Key] ) && ISINSCOPE( 'Date'[Year Month] ), [Monthly Inflation (R)],
ISINSCOPE( Receipts[Site_Item_Key] ), SUMX( VirtualTable, [@Monthly Inflation] ) ,
ISINSCOPE( 'Date'[Year Month] ), SUMX( VirtualTable2, [@Monthly Inflation] ), -- HELP
SUMX( VirtualTable, [@Monthly Inflation] )
)
The totals for each year month are wrong.