Power BI DAX — CONCATENATING text in measure returns duplicate rows (unexpected behavior)
18:58 09 Nov 2025

I’m working on a DAX measure that finds the previous Menu Type for each account based on From Date. I have three related tables:

'Accounts' — contains [Account Number]

'Account Adviser Link' — contains [Account Number], [From Date], [Product Name] (which corresponds to a badge code)

'Menu Type' — contains [Badge Code] and [Menu Type]

The following measure works perfectly and returns the correct previous menu type for each account/date combination

VAR CurrentAccount =
    SELECTEDVALUE('Accounts'[Account Number])
VAR CurrentDate =
    SELECTEDVALUE('Account Adviser Link'[From Date])

-- Find the previous date for this account (max date before current)
VAR PrevDate =
    CALCULATE(
        MAX('Account Adviser Link'[From Date]),
        FILTER(
            ALL('Account Adviser Link'),
            'Account Adviser Link'[Account Number] = CurrentAccount &&
            'Account Adviser Link'[From Date] < CurrentDate
        )
    )

-- Get the Product Name (Badge Code) for that previous date
VAR PrevBadge =
    CALCULATE(
        SELECTEDVALUE('Account Adviser Link'[Product Name]),
        FILTER(
            ALL('Account Adviser Link'),
            'Account Adviser Link'[Account Number] = CurrentAccount &&
            'Account Adviser Link'[From Date] = PrevDate
        )
    )

-- Clean the badge value to prevent case/space mismatches
VAR CleanPrevBadge = TRIM(UPPER(PrevBadge))

-- Find the Menu Type using cleaned Badge Code
VAR PrevMenu =
    CALCULATE(
        MAX('Menu Type'[Menu Type]),
        FILTER(
            ALL('Menu Type'),
            TRIM(UPPER('Menu Type'[Badge Code])) = CleanPrevBadge
        )
    )

RETURN
PrevMenu 

When I place this measure in a table with Account Number and From Date, it shows exactly the expected number of rows. enter image description here However, when I modify the return statement to add text (e.g. prefixing with "From: "), like this:

"From: " & PrevMenu

…the table suddenly returns many more rows per account — duplicate and incorrect results that don’t appear with the original measure.

It seems like concatenating text somehow changes the evaluation context or removes implicit filtering, but I’m not sure why.

What I’ve tried:

Wrapping PrevMenu in COALESCE() and SELECTEDVALUE()

Using FORMAT(PrevMenu, "")

Changing table visual fields (same issue persists)

Expected behavior: Same number of rows as original measure — just with "From: " prefixed (e.g. “From: Menu1”, “From: Menu2”, etc.)

powerbi dax measure