Forum Discussion
Get max multiple selected value from slice
I chose weeks 44 and 42, which would be 2 if it was the highest week. Less than 3 I don't understand why my data where weeks are less than weeks maximum doesn't meet the 3 criteria if weeks are less than weeks maximum.
Right result (But not DAX for multiple selected value from slicer):
My DAX Measure
My DAX:
Laset Week =
VAR SelectedWeek = ALLSELECTED(WeekSlicer[Week Create])
VAR Max_Week =
CALCULATE(
MAXX(
FILTER(
ALLEXCEPT(
DemandSummaryAPS,
DemandSummaryAPS[demandID],
DemandSummaryAPS[item],
DemandSummaryAPS[Week Num Due]
),
DemandSummaryAPS[Week Create] IN SelectedWeek
),
DemandSummaryAPS[Week Create]
)
)
RETURN
Max_Week
Now I can do this, I created a new Week Create table but didn't relationship it because if I concatenate the result would be the same.
There is a problem with LasetWeek which tells which week is the highest week.
LasetWeek =
VAR SelectedWeek = ALLSELECTED(WeekSlicer[Week Create])
VAR Max_Month =
CALCULATE(
MAXX(
FILTER(
ALLNOBLANKROW(DemandSummaryAPS),
'DemandSummaryAPS'[Week Create] IN SelectedWeek
),
DemandSummaryAPS[Week Create]
)
)
RETURN
Max_Month
6 Replies
- lbendlinSuper User
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523- Tiger2514555Helper III
Week Create id item quantity Week Due Check Measure Week By Week 42 F01 A2 30 40 3 -30 44 F01 A2 20 40 2 20 If I select the slicer Week Create 44 and 42, weeks with the highest measurement value must be 2, and weeks less than the highest will be 3 and negative values. Now I'm stuck with a problem. Week values that are less than my maximum week, check, measure all to 2.
lbendlin- lbendlinSuper User
- Tiger2514555Helper III
It doesn't work. lbendlin
My data like this:Week Create ID item quantity Week Due Check Measure Week By Week 42 F01 A2 30 40 3 -30 44 F01 A2 20 40 2 20 42 F02 A3 10 41 3 -10 44 F02 A3 10 41 2 10 42 F05 A5 60 42 3 -60 44 F06 A6 50 42 2 50 My Week By Week value comes from quantity, which is viewed from Check Measure. If it is 1, show the quantity value of the highest week minus the value of the lowest week. If it is 2, show the quantity value of the highest week. If it is 3, show the quantity value of minimal week and is a negative value Which is my Check Measure to find which data is 1,2,3 which is compared to Measure Laset Week which I use to find the highest Week Create selected from the Slicer.
If you need the file to review, I can send it to you in a private message.
My Check Measure :Check Measure =VAR FilteredTable =FILTER('DemandSummaryAPS','DemandSummaryAPS'[demandID] = ('DemandSummaryAPS'[demandID]) &&'DemandSummaryAPS'[item] = ('DemandSummaryAPS'[item]) &&'DemandSummaryAPS'[Week Num Due] = ('DemandSummaryAPS'[Week Num Due]) &&'DemandSummaryAPS'[demandID] <> BLANK())VAR Sum_Check =IF(COUNTROWS(FILTER(FilteredTable, 'DemandSummaryAPS'[Week Create] = [Laset Week])) > 0 &&COUNTROWS(FILTER(FilteredTable, 'DemandSummaryAPS'[Week Create] < [Laset Week])) > 0,1,IF(COUNTROWS(FILTER(FilteredTable, 'DemandSummaryAPS'[Week Create] = [Laset Week])) > 0 &&COUNTROWS(FILTER(FilteredTable, 'DemandSummaryAPS'[Week Create] < [Laset Week])) = 0,2,IF(COUNTROWS(FILTER(FilteredTable, 'DemandSummaryAPS'[Week Create] = [Laset Week])) = 0 &&COUNTROWS(FILTER(FilteredTable, 'DemandSummaryAPS'[Week Create] < [Laset Week])) > 0,3,0)))RETURNSum_Check- lbendlinSuper User
Your sample data is inconsistent with the code. [Laset Week] and [demandID] are missing.
- Tiger2514555Helper III
Now I can do this, I created a new Week Create table but didn't relationship it because if I concatenate the result would be the same.
There is a problem with LasetWeek which tells which week is the highest week.
LasetWeek =
VAR SelectedWeek = ALLSELECTED(WeekSlicer[Week Create])
VAR Max_Month =
CALCULATE(
MAXX(
FILTER(
ALLNOBLANKROW(DemandSummaryAPS),
'DemandSummaryAPS'[Week Create] IN SelectedWeek
),
DemandSummaryAPS[Week Create]
)
)
RETURN
Max_Month