Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All Experts,
Below is the PBI reportI have created for illustration purpose. There is a month slicer in the report. However, I need to have the full year revenue number which is not affected by the selection of the month in the slicer.
Below are the two measures I created. The measure 1 still interact with the 'Month' slicer although I use All('Date'[Month]), however, the measure 2 works well and meet my need.
The difference between measure 1 and measure 2 is only the filter on the Data[Account] = "Revenue". I use filter() for measure 1 but skip the filter() function for measure 2.
I can't figure out how filter() function affect the All() in the case above, can you please help?
Measure 1 - All() with Filter() function in the Measure
Measure 2 - All() without Filter() function in the Measure
Data Table
Date Table
Model View
Solved! Go to Solution.
Hi @kelvin-lkhca ,
The core of the issue you're experiencing relates to how the 'Filter()' function interacts with the 'All()' function within the context of a measure and slicer selections. When you use the 'All()' function, you're essentially instructing Power BI to ignore filters that might be applied to the column(s) specified within the 'All()' function. This is typically used to calculate aggregate values over all the data, ignoring any slicer or filter context.
However, when you introduce the 'Filter()' function into the mix, you're applying a new filter context to the calculation. Even though you're using 'All()' to ignore certain filters, the 'Filter()' function applies a new filter which then becomes part of the calculation context.
In your Measure 1, the use of 'Filter()' alongside 'All()' means that while you're asking Power BI to ignore slicer selections on the 'Date'[Month] column, you're simultaneously applying a filter on the 'Data'[Account] column. This creates a specific context that still respects the filter applied by the 'Filter()' function.
For Measure 2, by omitting the 'Filter()' function, you're allowing the 'All()' function to work unimpeded, thus ignoring all slicer selections and calculating the value over the entire dataset as you intended.
To achieve your goal of having a full year revenue number unaffected by the month slicer, while still applying specific filters like 'Data[Account] = "Revenue"', consider restructuring your DAX formula to ensure that 'All()' is applied in a way that truly ignores all unwanted filters. One approach could be to use 'CALCULATE()' in combination with 'All()', explicitly defining the filter within 'CALCULATE()' to ensure it applies only where you intend.
For example:
Total Revenue = CALCULATE(SUM(Data[Revenue]), ALL('Date'[Month]), Data[Account] = "Revenue")
This formula ensures that the revenue is summed over all months, regardless of slicer selection, but still filters the data to include only "Revenue" accounts.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @kelvin-lkhca ,
The core of the issue you're experiencing relates to how the 'Filter()' function interacts with the 'All()' function within the context of a measure and slicer selections. When you use the 'All()' function, you're essentially instructing Power BI to ignore filters that might be applied to the column(s) specified within the 'All()' function. This is typically used to calculate aggregate values over all the data, ignoring any slicer or filter context.
However, when you introduce the 'Filter()' function into the mix, you're applying a new filter context to the calculation. Even though you're using 'All()' to ignore certain filters, the 'Filter()' function applies a new filter which then becomes part of the calculation context.
In your Measure 1, the use of 'Filter()' alongside 'All()' means that while you're asking Power BI to ignore slicer selections on the 'Date'[Month] column, you're simultaneously applying a filter on the 'Data'[Account] column. This creates a specific context that still respects the filter applied by the 'Filter()' function.
For Measure 2, by omitting the 'Filter()' function, you're allowing the 'All()' function to work unimpeded, thus ignoring all slicer selections and calculating the value over the entire dataset as you intended.
To achieve your goal of having a full year revenue number unaffected by the month slicer, while still applying specific filters like 'Data[Account] = "Revenue"', consider restructuring your DAX formula to ensure that 'All()' is applied in a way that truly ignores all unwanted filters. One approach could be to use 'CALCULATE()' in combination with 'All()', explicitly defining the filter within 'CALCULATE()' to ensure it applies only where you intend.
For example:
Total Revenue = CALCULATE(SUM(Data[Revenue]), ALL('Date'[Month]), Data[Account] = "Revenue")
This formula ensures that the revenue is summed over all months, regardless of slicer selection, but still filters the data to include only "Revenue" accounts.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous Great explanation! Thanks a lot for that!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 64 | |
| 32 | |
| 31 | |
| 27 |