Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Customer Name Card Visual

Hello All!

 

I'm working on a problem that seems pretty simple, but for some reason I'm not seeing the solution. I have a table that contains the customer name & rank. 

 

clientRank
Google1
Microsoft2
Apple3
Amazon4

 

In the PBIX file, I can add cards displaying customer names & use the filter pane to specify which customer to display by the rank value. 

 

 

 

 

 

 

 

 

 

 

 

I'm trying to figure out how to get the same functionality by using a measure instead of the filter pane. In other words, how can I set the card up to display the client name based on the rank specified in the measure. My thought is something like this but I know it won't work:

 

FILTER(
     VALUES(Sheet1[client]),
     Sheet1[Rank] = 4
)

 


link to pbix file on google drive 

link to underlying data on google drive 

 

Thanks for your time! 

  • @ccapowerbi

    There are several options, using the filter:

    Measure = 
    MAXX(
        FILTER(
            Sheet1,
            Sheet1[Rank]= 4
        ),
        Sheet1[client]
    )


    using Lookupvalue

    Measure 2 = 
    
    LOOKUPVALUE(Sheet1[client],Sheet1[Rank],4)

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click the Thumbs-Up icon if you like this answer 🙂

    Youtube Linkedin

3 Replies

  • @ccapowerbi

    There are several options, using the filter:

    Measure = 
    MAXX(
        FILTER(
            Sheet1,
            Sheet1[Rank]= 4
        ),
        Sheet1[client]
    )


    using Lookupvalue

    Measure 2 = 
    
    LOOKUPVALUE(Sheet1[client],Sheet1[Rank],4)

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click the Thumbs-Up icon if you like this answer 🙂

    Youtube Linkedin

  • Anonymous , You can have hardcoded filter like

    maxx(filter(VALUES(Sheet1[client]), Sheet1[Rank] = 4),sheet[client])

     

    or create a what if parameter and use that

    maxx(filter(VALUES(Sheet1[client]), Sheet1[Rank] = selectedvalue(parameter[parameter])),sheet[client])

    https://docs.microsoft.com/en-us/power-bi/desktop-what-if

     

     

    https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415

     

    https://radacad.com/pivot-and-unpivot-with-power-bi
    Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    According to my understanding, you want to use Card visual to display Client based the selected rank , right?

    I did it in two ways.

     

    1. Use slicer

    // Create a new table for slicer

    forSlicer =
    ALLSELECTED ( CustomRank[Rank] )
    slicerMeaure =
    VAR _sele =
        SELECTEDVALUE ( forSlicer[Rank] )
    RETURN
        CALCULATE (
            SELECTEDVALUE ( 'CustomRank'[Client] ),
            FILTER ( CustomRank, CustomRank[Rank] = _sele )
    )

    2.Use What-if parameter

    //Create a What-if parameter:

    Parameter =
    GENERATESERIES ( MIN ( CustomRank[Rank] ), MAX ( CustomRank[Rank] ), 1 )
    parameterMeaure =
    VAR _sele =
        SELECTEDVALUE ( Parameter[Parameter] )
    RETURN
        CALCULATE (
            SELECTEDVALUE ( 'CustomRank'[Client] ),
            FILTER ( CustomRank, CustomRank[Rank] = _sele )
        )

    '

    Is the result what you want? If you have any questions, please upload some data samples and expected output.

    Please do mask sensitive data before uploading.

     

    Best Regards,

    Eyelyn Qin