Forum Discussion
Tiger2514555
Helper III
2 years agoSub total of the Matrix does not include values.
I'm not sure what's wrong with DAX and how to fix it so that the sub total values can be summed up.
From what I've seen, it only shows sub total if my DAX is followed once before it shows sub total. If there is more than one month it doesn't show sub total.
My DAX:
Week By Week =
VAR FilteredTable =
FILTER(
'DemandSummaryAPS',
'DemandSummaryAPS'[demandID] = SELECTEDVALUE('DemandSummaryAPS'[demandID]) &&
'DemandSummaryAPS'[item] = SELECTEDVALUE('DemandSummaryAPS'[item]) &&
'DemandSummaryAPS'[Week Num Due] = SELECTEDVALUE('DemandSummaryAPS'[Week Num Due]) &&
'DemandSummaryAPS'[Lastest] = 1
)
VAR MaxWeekNumCreate =
SUMX(
FILTER(
FilteredTable,
'DemandSummaryAPS'[Week Num Create] = MAXX(FilteredTable, 'DemandSummaryAPS'[Week Num Create])
),
'DemandSummaryAPS'[quantity]
)
VAR MinWeekNumCreate = SUMX(
FILTER(
FilteredTable,
'DemandSummaryAPS'[Week Num Create] = MINX(FilteredTable, 'DemandSummaryAPS'[Week Num Create])
),
'DemandSummaryAPS'[quantity]
)
VAR SUM_Week_By_Week = MaxWeekNumCreate - MinWeekNumCreate
RETURN
MaxWeekNumCreate - MinWeekNumCreate
4 Replies
- some_bih
Community Champion
Hi Tiger2514555 try v2
My DAX v2:Week By Week =VAR FilteredTable =FILTER('DemandSummaryAPS','DemandSummaryAPS'[demandID] = SELECTEDVALUE('DemandSummaryAPS'[demandID]) &&'DemandSummaryAPS'[item] = SELECTEDVALUE('DemandSummaryAPS'[item]) &&'DemandSummaryAPS'[Week Num Due] = SELECTEDVALUE('DemandSummaryAPS'[Week Num Due]) &&'DemandSummaryAPS'[Lastest] = 1)VAR _max_week_num=MAXX(FilteredTable, 'DemandSummaryAPS'[Week Num Create])VAR _min_week_num=MINX(FilteredTable, 'DemandSummaryAPS'[Week Num Create])VAR MaxWeekNumCreate =SUMX(FILTER(FilteredTable,'DemandSummaryAPS'[Week Num Create] = _max_week_num),'DemandSummaryAPS'[quantity])VAR MinWeekNumCreate = SUMX(FILTER(FilteredTable,'DemandSummaryAPS'[Week Num Create] = _min_week_num),'DemandSummaryAPS'[quantity])VAR SUM_Week_By_Week = MaxWeekNumCreate - MinWeekNumCreateRETURNMaxWeekNumCreate - MinWeekNumCreate- Tiger2514555
Helper III
- some_bih
Community Champion
Hi Tiger2514555 without file it is hard to understand details, like
'DemandSummaryAPS'[Lastest] = 1
what this should be? Latest mean...
- Tiger2514555
Helper III
I filtered it for the last two weeks of research.