No, that DAX formula is not correct.
It has a syntax error that will prevent it from working in Power BI or any other DAX environment.
The Errors in Your Formula
- Incorrect Use of Single Quotes: The function
ALL is a DAX function, not a table name. It should not be enclosed in single quotes like this: 'all(. Single quotes are used for table or column names that contain spaces or special characters (e.g., 'My Table').
- Incorrect Structure: The
ALL function is a table function that is typically used as a filter modifier inside the CALCULATE function. You cannot place it directly inside DISTINCTCOUNT in that manner.
What You Are Likely Trying to Do
Your measure name, Total Increased agents, suggests you want to count the unique NRD No. values and ensure that this count is not affected by any slicers or filters in your report.
Here are the correct ways to write this formula, depending on your exact goal.
Option 1: The Most Likely Correct Formula
If you want to count all distinct NRD No. values from the 'INCREASED_february' table, ignoring all filters applied to that table in your report, you should use CALCULATE.
Total Increased agents =
CALCULATE (
DISTINCTCOUNT ( 'INCREASED_february'[NRD No.] ),
ALL ( 'INCREASED_february' )
)
How this works:
DISTINCTCOUNT('INCREASED_february'[NRD No.]): This is the core calculation—counting the unique NRD numbers.
CALCULATE(...): This function modifies the context in which the calculation is performed.
ALL('INCREASED_february'): This is the modifier. It tells CALCULATE to remove all filters from the 'INCREASED_february' table before performing the distinct count. The result will always be the grand total of unique agents in that table.
Option 2: The Simpler Formula (If You Don't Need to Ignore Filters)
If you simply want a distinct count of agents that does change when you use slicers, then you don't need CALCULATE or ALL.
Increased agents =
DISTINCTCOUNT ( 'INCREASED_february'[NRD No.] )
How this works:
- This measure will count the unique
NRD No. values within the current "filter context." For example, if you have a slicer for "Region" and you select "North," this measure will show you the distinct count of agents only for the North region.
Summary
| Your Goal | Correct DAX Formula |
|---|
| Get a grand total of unique agents that does not change with report filters. | CALCULATE( DISTINCTCOUNT('INCREASED_february'[NRD No.]), ALL('INCREASED_february') ) |
| Get a count of unique agents that does change based on slicers and filters. | DISTINCTCOUNT('INCREASED_february'[NRD No.]) |
Given your measure name, Option 1 is almost certainly what you need.