Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Card shows multiple selections rather than just one

Hi all,

 

I have a dashboard that has data that looks some this:

AlphabetNumber
A1
B1
C2
D2

 

In my dashboard, I have a card that displays the numbers and I have a filter that allows multiple selections so that multiple alphabets can be selected. Is it possible to write a DAX function for the card so that when there are multiple numbers let's say when A and C is selected, the card will display: Multiple numbers rather than just one? Thanks. 

  • Hi Anonymous 

    Create a measure as:

     

    Measure = CONCATENATEX(
    
        VALUES('Table'[Number]),
    
        CALCULATE(
    
            MAX('Table'[Number]),
    
            'Table'[Alphabet] IN FILTERS('Table'[Alphabet])),","
    
            )

     

     

    Here is the output:

    Here is the demo, please try it: Card shows multiple selections rather than just one

     

    Best Regards,

    Link

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

10 Replies

  • Anonymous , Create measure like these and use

     

    Measure = if( countx(allselected(Table), Table[Alphabet]) >1, "Multiple Selected", "Single Selected")

     

    Value selected

    concatenatex(allselected(Table), Table[Alphabet] , " , ")

    concatenatex(Table, Table[Alphabet], " , ")

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi is it possible to show the number (i.e 1 or 2) instead of 'single selected'. Thanks

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        Anonymous ,

        this will give number

        so use this

        countx(allselected(Table), Table[Alphabet])

         

        or create any combination

        Measure =

        var _cnt = countx(allselected(Table), Table[Alphabet]) 

        return

        if( _cnt >1, _cnt & "" , "Single Selected")

         

         

  • v-xulin-mstf's avatar
    v-xulin-mstf
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    Create a measure as:

     

    Measure = CONCATENATEX(
    
        VALUES('Table'[Number]),
    
        CALCULATE(
    
            MAX('Table'[Number]),
    
            'Table'[Alphabet] IN FILTERS('Table'[Alphabet])),","
    
            )

     

     

    Here is the output:

    Here is the demo, please try it: Card shows multiple selections rather than just one

     

    Best Regards,

    Link

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.