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
Anonymous
Not applicable

what can the slicer filter and what cannot

Hi everyone, I am a bit confused about what can the slicer filter and what cannot in the visualization.

 

I created a measure which calculates the cumulative sales revenue:

 

Cumulative Sales Actual =
CALCULATE (
    SUM('Actual data'[Net sales revenue]),
    FILTER (
        ALL ( 'Actual data'),
        ('Actual data'[Period/year] <= MAX ( 'Actual data'[Period/year] )) && (YEAR('Actual data'[Period/year]) = YEAR( MAX ('Actual data'[Period/year])))
    )
)

 

In the same table, I have a column called Division. I add the slicer of Divsion and try to get the cumulative sales actual for specific division, but find that the Cumulative Sales Actual doesn't change. But if I add slicer for Period.year, the cumulative sales actual changes. So I am confused with the algorithm with the slicer. Can anyone help me explane it?

1 ACCEPTED SOLUTION
Daniil
Kudo Kingpin
Kudo Kingpin

The results you see have nothing to do with the slicer.

 

When you write ALL('Actual data'), you remove all filters from the table. Therefore, slicing by 'Actual data'[Division] has no effect on the calculation.

 

The reason why you see different results when you slice by 'Actual data'[Period/year] is that MAX('Actual data'[Period/year]) is evaluated in the original filter context, before you override it with ALL. Hence, changing the value of 'Actual data'[Period/year] influences the calculations.

 

I would change your formula to the following one:

Cumulative Sales Actual =
CALCULATE (
    SUM ( 'Actual data'[Net sales revenue] ),
    FILTER (
        ALL ( 'Actual data'[Period/year] ),
        ( 'Actual data'[Period/year] <= MAX ( 'Actual data'[Period/year] ) )
            && (
                YEAR ( 'Actual data'[Period/year] )
                    = YEAR ( MAX ( 'Actual data'[Period/year] ) )
            )
    )
)

 

View solution in original post

2 REPLIES 2
Daniil
Kudo Kingpin
Kudo Kingpin

The results you see have nothing to do with the slicer.

 

When you write ALL('Actual data'), you remove all filters from the table. Therefore, slicing by 'Actual data'[Division] has no effect on the calculation.

 

The reason why you see different results when you slice by 'Actual data'[Period/year] is that MAX('Actual data'[Period/year]) is evaluated in the original filter context, before you override it with ALL. Hence, changing the value of 'Actual data'[Period/year] influences the calculations.

 

I would change your formula to the following one:

Cumulative Sales Actual =
CALCULATE (
    SUM ( 'Actual data'[Net sales revenue] ),
    FILTER (
        ALL ( 'Actual data'[Period/year] ),
        ( 'Actual data'[Period/year] <= MAX ( 'Actual data'[Period/year] ) )
            && (
                YEAR ( 'Actual data'[Period/year] )
                    = YEAR ( MAX ( 'Actual data'[Period/year] ) )
            )
    )
)

 

Anonymous
Not applicable

Thank you very much! I finally understand!

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.