Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-5-haiku-20241022· AnthropicHugging Face LMArena Human Preference 140K

in this formula Total Increased agents = CALCULATE(…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmistral-medium-2505’s answer.
  1. User

    in this formula Total Increased agents = CALCULATE( DISTINCTCOUNT('INCREASED_february'[NRD No.]), ALL('INCREASED_february') ) the table 'increased_february' has a column named 'month'. I want to calculate the total but for the current month without having to edit the month name monthly. Is there something like getdate() for this case?

  2. Claude Assistant

    In DAX, you can use the MONTH() function combined with TODAY() or a specific date to dynamically select the current month. Here are a few approaches:

    Option 1: Using TODAY()

    Total Increased agents = 
    CALCULATE(
        DISTINCTCOUNT('INCREASED_february'[NRD No.]),
        ALL('INCREASED_february'),
        'INCREASED_february'[month] = FORMAT(TODAY(), "MMMM")
    )
    

    Option 2: Using a Variable for Current Month

    Total Increased agents = 
    VAR CurrentMonth = FORMAT(TODAY(), "MMMM")
    RETURN
    CALCULATE(
        DISTINCTCOUNT('INCREASED_february'[NRD No.]),
        ALL('INCREASED_february'),
        'INCREASED_february'[month] = CurrentMonth
    )
    

    Option 3: If You Want to Use the Numeric Month

    Total Increased agents = 
    CALCULATE(
        DISTINCTCOUNT('INCREASED_february'[NRD No.]),
        ALL('INCREASED_february'),
        'INCREASED_february'[month] = FORMAT(TODAY(), "MMMM")
    )
    

    Key points:

    • TODAY() gives the current date
    • FORMAT() converts the date to a month name or number
    • "MMMM" gives the full month name (e.g., "February")
    • "MM" would give the numeric month (e.g., "02")

    Choose the option that best matches your data format. The measure will automatically update to the current month each time the report is refreshed.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.