Forum Discussion
SELECTEDVALU matrix total some BLANK
selectedvalue() needs filter context or it will always show blank if giving multiple values as its intended for only one value.
use a different aggregation function like max or min if you are looking at multiple values, you will still need to return one value.
https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/
But in my total there are several contexts that I think might need to be changed to a different one.
Because I need the difference of Week Num Create 45 and 44. with quantities which have many values in case I want to see in total.
So do you have any ideas on how to fix it?
- vanessafvg2 years ago
Community Champion
if you can provide some sample data with and example of your expected result then it will be easier to help you.
- Tiger25145552 years ago
Helper III
I have the same product but the DemandID is different. I want to compare volumes to see how much they increased or decreased using Week Num Create as a basis. Right now I'm using the most recent week and the previous week. Now I can get it to display correctly in the weekly column. But the total field is not displayed correctly. I want the correct total to be displayed.
My DAX use now:Week By Week =VAR FilteredTable =FILTER('DemandSummaryAPS','DemandSummaryAPS'[demandID] = 'DemandSummaryAPS'[demandID] &&'DemandSummaryAPS'[item] = 'DemandSummaryAPS'[item] &&'DemandSummaryAPS'[Week Num Due] = 'DemandSummaryAPS'[Week Num Due] &&'DemandSummaryAPS'[demandID] <> BLANK())VAR _max_demand_id =MAXX(FilteredTable, 'DemandSummaryAPS'[demandID])VAR _min_demand_id =MINX(FilteredTable, 'DemandSummaryAPS'[demandID])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 =IF(_max_demand_id = _min_demand_id,SUMX(VALUES('DemandSummaryAPS'[item]),MaxWeekNumCreate - MinWeekNumCreate),0)RETURNSUM_Week_By_Week
vanessafvg