Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Tiger2514555
Helper III
Helper III

Get max multiple selected value from slice

Tiger2514555_0-1700214472115.png

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):

Tiger2514555_1-1700214895241.png

 

My DAX 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 _max_week_num =
    MAXX(FilteredTable, 'DemandSummaryAPS'[Week Create])

VAR _min_week_num =
    MINX(FilteredTable, 'DemandSummaryAPS'[Week Create])


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
            )
        )
    )
RETURN
    Sum_Check



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

1 ACCEPTED SOLUTION
Tiger2514555
Helper III
Helper 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

View solution in original post

6 REPLIES 6
Tiger2514555
Helper III
Helper 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

Tiger2514555
Helper III
Helper III

Tiger2514555_0-1700449738655.png

It doesn't work. @lbendlin 
My data like this:

Week CreateIDitemquantityWeek DueCheck MeasureWeek By Week
42F01A230403-30
44F01A22040220
42F02A310413-10
44F02A31041210
42F05A560423-60
44F06A65042250

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
            )
        )
    )
RETURN
    Sum_Check

Your sample data is inconsistent with the code.  [Laset Week] and [demandID] are missing. 

lbendlin
Super User
Super 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-...
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/1447...

Week CreateiditemquantityWeek DueCheck MeasureWeek By Week
42F01A230403-30
44F01A22040220

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 

see attached

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.