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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
schwinnen
Helper V
Helper V

Filter - ALL, ALLSELECTED, ALLEXCEPT

I use the formula below to calculate change from previous week.  This works well when no filters are applied (or only applied to the 3 categories I have in the formula - NAME, BRAND and active_status).  Is there a way to make this work regardless of what filters are applied?  I can inlude every possible filter category in the formula, but it seems like there should be an easier way.  I've tried variations of ALL, ALLSELECTED and ALLEXCEPT, but nothing has worked so far.

 

CHANGE =
    VAR lastWeekAmount =
    CALCULATE (
         [COMPLETE %],
        FILTER(ALLEXCEPT('Stop', Core[NAME], Core[BRAND], Core[active_status]), Stop[TOTAL WEEK #]
                = MIN (Stop[TOTAL WEEK #])-1))
RETURN
    [COMPLETE %] - lastWeekAmount
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @schwinnen 

You could try this formula

CHANGE =
VAR lastWeekAmount =
    CALCULATE (
        [COMPLETE %],
        FILTER (
            ALL ( Stop[TOTAL WEEK #] ),
            Stop[TOTAL WEEK #]
                = MIN ( Stop[TOTAL WEEK #] ) - 1
        )
    )
RETURN
    [COMPLETE %] - lastWeekAmount

 

or

 

CHANGE =
VAR lastWeekAmount =
    CALCULATE (
        [COMPLETE %],
        FILTER (
            ALLSELECTED ( 'Stop' ),
            Stop[TOTAL WEEK #]
                = MIN ( Stop[TOTAL WEEK #] ) - 1
        )
    )
RETURN
    [COMPLETE %] - lastWeekAmount

 

If not your case, just share a simple sample pbix file and the expected output in different scenarios.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi @schwinnen 

You could try this formula

CHANGE =
VAR lastWeekAmount =
    CALCULATE (
        [COMPLETE %],
        FILTER (
            ALL ( Stop[TOTAL WEEK #] ),
            Stop[TOTAL WEEK #]
                = MIN ( Stop[TOTAL WEEK #] ) - 1
        )
    )
RETURN
    [COMPLETE %] - lastWeekAmount

 

or

 

CHANGE =
VAR lastWeekAmount =
    CALCULATE (
        [COMPLETE %],
        FILTER (
            ALLSELECTED ( 'Stop' ),
            Stop[TOTAL WEEK #]
                = MIN ( Stop[TOTAL WEEK #] ) - 1
        )
    )
RETURN
    [COMPLETE %] - lastWeekAmount

 

If not your case, just share a simple sample pbix file and the expected output in different scenarios.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.