Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet 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
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))
Solved! Go to 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]))
1. Calculate the real count by year filter and quarter filter.
Result: allselected table work, allselected column not work.
2. Test with date slicer.
Result: allselected(table) and allselected(column) works.
3. Test with date slicer and line chart.
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
Hi @lilyyan,
Can you provide the pbix file to test? I'm not very clear for your measure "Total Sales".
Regards,
Xiaoxin Sheng
@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])
:
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]))
1. Calculate the real count by year filter and quarter filter.
Result: allselected table work, allselected column not work.
2. Test with date slicer.
Result: allselected(table) and allselected(column) works.
3. Test with date slicer and line chart.
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
@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?
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
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
90 | |
84 | |
77 | |
49 |
User | Count |
---|---|
143 | |
140 | |
109 | |
69 | |
55 |