Yes! You can dynamically filter the 'INCREASED_february' table to only include rows where the Month column matches the current month (based on the system date) without hardcoding the month name.
Solution: Use MONTH() and YEAR() with TODAY()
Since you want to filter by the current month (e.g., if today is June 2024, it should only count records where Month = "June"), you can use:
Total Increased agents =
CALCULATE (
DISTINCTCOUNT ( 'INCREASED_february'[NRD No.] ),
FILTER (
'INCREASED_february',
'INCREASED_february'[Month] = FORMAT ( TODAY(), "MMMM" ) // "June", "July", etc.
)
)
Alternative (If Month is stored as a number, e.g., 1 for January, 2 for February, etc.)
If your Month column is numeric (e.g., 1 for January, 2 for February, etc.), use:
Total Increased agents =
CALCULATE (
DISTINCTCOUNT ( 'INCREASED_february'[NRD No.] ),
FILTER (
'INCREASED_february',
'INCREASED_february'[Month] = MONTH ( TODAY() ) // Returns 1-12
)
)
Alternative (If Month is stored as a date, e.g., "2024-06-01")
If your Month column is a date (e.g., 2024-06-01 for June), you can use:
Total Increased agents =
CALCULATE (
DISTINCTCOUNT ( 'INCREASED_february'[NRD No.] ),
FILTER (
'INCREASED_february',
YEAR ( 'INCREASED_february'[Month] ) = YEAR ( TODAY() ) &&
MONTH ( 'INCREASED_february'[Month] ) = MONTH ( TODAY() )
)
)
Key Functions Used
| Function | Purpose |
|---|
TODAY() | Returns the current date (e.g., 2024-06-15). |
MONTH() | Extracts the month number (1-12) from a date. |
YEAR() | Extracts the year from a date. |
FORMAT( TODAY(), "MMMM" ) | Returns the full month name (e.g., "June"). |
FILTER() | Filters the table to only rows matching the condition. |
Result
- The measure will automatically update each month without manual changes.
- It will only count
NRD No. where the Month column matches the current month.
Would you like any modifications based on how your Month column is structured?