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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
lilyyan
Frequent Visitor

What's the difference between ALL vs. ALLSELECTED, with formula filter as table vs. column

The original file Understanding Your Customers is downloaded from http://enterprisedna.co/power-bi-resources.

 

When calculating the total sales with different filters ALL and ALLSELECTED, with formula filter as table vs. column, the different results totally confused me. 

 

Here's the different results:

1. For Cumulative Caculation, ALL( Dates[Date]), ALLSELECTED(Dates[Date]), ALL(Dates) are same ignoring report filter, different with ALLSELECTED( Dates)

Cumulative Sales =

CALCULATE(

[Total Sales] ,

FILTER(

ALL( Dates[Date]),

Dates[Date] <= MAX( Dates[Date])))

 

Cumulative Sales 2 =

CALCULATE(

[Total Sales] ,

FILTER(

ALLSELECTED(Dates[Date]),

Dates[Date] <= MAX( Dates[Date])))

 

Cumulative Sales 3 =

CALCULATE(

[Total Sales],

FILTER(

ALL(Dates),

Dates[Date]<=MAX(Dates[Date])))

 

Cumulative Sales (Selected) =

CALCULATE( [Total Sales] ,

FILTER(

ALLSELECTED( Dates),

Dates[Date] <= MAX( Dates[Date])))

 

2. But for calculation of all dates, ALL(Dates[Date]), ALLSELECTED(Dates[Date]), ALLSELECTED(Dates) are same with report filter working, different with ALL( Dates)

 

Total Sales (all selected) =

CALCULATE( [Total Sales] , all( Dates[Date] ))

 

Total Sales (all Selected) 2=

CALCULATE( [Total Sales] , ALLSELECTED( Dates[Date] ))

 

Total Sales (all selected)3 =

CALCULATE( [Total Sales] , ALLSELECTED( Dates))

 

Total Sales (all) =

CALCULATE( [Total Sales] , ALL( Dates))

Picture1.png

 

 

1 ACCEPTED SOLUTION

Hi @lilyyan,

 

I think I found the reason, please take a look at below  test steps.

 

Measure used to display the current row count.

All(Table)/All(Column)/AllSelected(Table)/Allselected(Column) = COUNTROWS(ALL(Dates))&"-"&COUNTROWS(ALL(Dates[Date]))&"-"&COUNTROWS(ALLSELECTED(Dates))&"-"&COUNTROWS(ALLSELECTED(Dates[Date]))

2.PNG

 

 

1. Calculate the real count by year filter and quarter filter.

1.PNG

 

Result: allselected table work, allselected column not work.

 

2. Test with date slicer.

3.PNG

 

Result: allselected(table) and allselected(column) works.

 

3. Test with date slicer and line chart.

4.PNG

 

In summary, when you use allselected function, you should remember allselected(table) can works on all of its columns, but allselected(column) only works on the slicer with specify column as the source.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

7 REPLIES 7
v-shex-msft
Community Support
Community Support

Hi @lilyyan,

 

Can you provide the pbix file to test? I'm not very clear for your measure "Total Sales".

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msftSorry that I don't know how to attach the file here. It's downloaded as mentioned in post: Understanding Your Customers from http://enterprisedna.co/power-bi-resources. 

 

The source data file as below, including one row named Total Revenue. And Total Sales = SUM(Sales[Total Revenue])

:Capture.PNG

 

@v-shex-msftpls refer to the pbxi file here

Hi @lilyyan,

 

I think I found the reason, please take a look at below  test steps.

 

Measure used to display the current row count.

All(Table)/All(Column)/AllSelected(Table)/Allselected(Column) = COUNTROWS(ALL(Dates))&"-"&COUNTROWS(ALL(Dates[Date]))&"-"&COUNTROWS(ALLSELECTED(Dates))&"-"&COUNTROWS(ALLSELECTED(Dates[Date]))

2.PNG

 

 

1. Calculate the real count by year filter and quarter filter.

1.PNG

 

Result: allselected table work, allselected column not work.

 

2. Test with date slicer.

3.PNG

 

Result: allselected(table) and allselected(column) works.

 

3. Test with date slicer and line chart.

4.PNG

 

In summary, when you use allselected function, you should remember allselected(table) can works on all of its columns, but allselected(column) only works on the slicer with specify column as the source.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msftthanks for the explanation. 

 

When drilling down into different filter/slicer, it's confused again. The pbix file is shared here

I renamed all referred measures for better understanding. And then I selected the filters/slicers step by step: Page filter: Year = 2014, 2015, 2016 -> Slicer: Year = 2015 -> Slicer: Date = 8/3/2014-6/28/2015. The results after every step are quite confusing. 

And now my main confused point is the difference between **bleep** and All for all-column and allselcted column. 

Can u have a check and see why? Untitled.png

 

 

Hi @lilyyan,

 

In my opinion, I'd like to suggest you to test with single date slicer. I'm not so sure the interaction of multiple slicers and filters if they will affect the measure calculation.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi, @v-shex-msft

I tried with single slicers, exactly same, no change.Man Sad

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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