Forum Discussion

Rakesk13's avatar
Rakesk13
Helper III
2 months ago
Solved

How to get Count from two different table- Un-match Count Table Record with New Table

Hi team,   i have data like this :    EMP Details     EMP ID  EMP NAME  AGE AMT 1 A 1 1000 2 B 2 45 3 C 3 2000 4 D 6 3444 ...
  • v-kpoloju-msft's avatar
    v-kpoloju-msft
    2 months ago

    Hi Rakesk13
    Thank you for the screenshot and follow-up question.

    The error occurs because the DAX was converted into a measure. Measures do not have row context, so Power BI cannot determine a single EMP ID value and returns the "A single value for column cannot be determined" error. 

    In this scenario, use a calculated column instead of a measure. Create a column that first identifies unmatched EMP IDs and then uses LOOKUPVALUE (or RELATED if a relationship exists) to return the matching EMP NAME from EMP_ADD. After that, filter the visual to show only rows where the returned value is not blank. This will return the expected records E, BB, and FF.

    Create this column in Sheet1 (2):

    Matched_Name =
    VAR IsUnmatched =
        NOT (
            'Sheet1 (2)'[EMP ID]
                IN VALUES ( 'EMP Details'[EMP ID_DE] )
        )
    RETURN
    IF (
        IsUnmatched,
        LOOKUPVALUE (
            EMP_ADD[EMP NAME],
            EMP_ADD[EMP NAME], 'Sheet1 (2)'[EMP NAME]
        ),
        BLANK()
    )

    Then add:

    Show_Record =
    IF (
        NOT ISBLANK ( 'Sheet1 (2)'[Matched_Name] ),
        1,
        0
    )

    Filter the visual:

    Show_Record = 1

     

    Hope this helps. If you have any questions regarding this, please feel free to reach out us. We will be happy to help.