Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. 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
@AnonymousSorry 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
@Anonymousthanks 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
Hi, @Anonymous
I tried with single slicers, exactly same, no change.
User | Count |
---|---|
80 | |
71 | |
70 | |
56 | |
50 |
User | Count |
---|---|
43 | |
41 | |
37 | |
34 | |
30 |