Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX help

I have my table like this

Name     Hasloggedin

A             Yes

B              Yes

C              No

D              Yes

 

I want ot return names where hasloggedin= Yes and hasloggedin=no.

If iam using DAX =Calculate(distinct(name),Hasloggedin="Yes")  I am getting an error multiple values found where single value expected, how to do it??

  • Mariusz's avatar
    Mariusz
    7 years ago

    Hi Anonymous 

    Try the below

    Yes = 
    CONCATENATEX(
        CALCULATETABLE(
            VALUES( YourTable[Name] ),
            YourTable[Hasloggedin] = "Yes"
        ),
        YourTable[Name], ", "
    )
    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski



4 Replies

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi Anonymous 

    You can use the below DAX measures.

    Yes = 
    CONCATENATEX(
        FILTER(
            YourTable,
            YourTable[Hasloggedin] = "Yes"
        ),
        YourTable[Name], ", "
    )
    No = 
    CONCATENATEX(
        FILTER(
            YourTable,
            YourTable[Hasloggedin] = "No"
        ),
        YourTable[Name], ", "
    )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      works fine but Iam having problem If i have multiple value in my name column, if i use disitnct its showing the same error (multuiple values supplied when expecting 1 value)

      • Mariusz's avatar
        Mariusz
        Community Champion

        Hi Anonymous 

        Try the below

        Yes = 
        CONCATENATEX(
            CALCULATETABLE(
                VALUES( YourTable[Name] ),
                YourTable[Hasloggedin] = "Yes"
            ),
            YourTable[Name], ", "
        )
        Best Regards,
        Mariusz

        If this post helps, then please consider Accepting it as the solution.

        Please feel free to connect with me.
        Mariusz Repczynski