Forum Discussion

trdoan's avatar
trdoan
Helper III
7 years ago
Solved

Card Visual to return value matching slicer selection

Hello everyone,   Here  is my sample data. Please only consider 2 sheets "Contact" and "General Info" (my 2 tables in Power BI).   I have a slicer created from 'General Info'[Store Name].   Ass...
  • v-yuta-msft's avatar
    7 years ago

    trdoan ,

     

    Create 6 measures using DAX as below:

    Primary Name = 
    VAR temp = CALCULATE(MAX(Contact[Name]), FILTER(Contact, Contact[Contact Type] = "Primary Customer Service" && Contact[Store] = SELECTEDVALUE('General Info'[Column1])))
    RETURN 
    IF(ISBLANK(temp), "N/A", temp)
    
    Primary Phone = 
    VAR temp = CALCULATE(MAX(Contact[Phone]), FILTER(Contact, Contact[Contact Type] = "Primary Customer Service" && Contact[Store] = SELECTEDVALUE('General Info'[Column1])))
    RETURN 
    IF(ISBLANK(temp), "N/A", temp)
    
    Secondary Name = 
    VAR temp = CALCULATE(MAX(Contact[Name]), FILTER(Contact, Contact[Contact Type] = "Secondary Customer Service" && Contact[Store] = SELECTEDVALUE('General Info'[Column1])))
    RETURN 
    IF(ISBLANK(temp), "N/A", temp)
    
    Secondary Phone = 
    VAR temp = CALCULATE(MAX(Contact[Phone]), FILTER(Contact, Contact[Contact Type] = "Secondary Customer Service" && Contact[Store] = SELECTEDVALUE('General Info'[Column1])))
    RETURN 
    IF(ISBLANK(temp), "N/A", temp)
    
    General Manager Name = 
    VAR temp = CALCULATE(MAX(Contact[Name]), FILTER(Contact, Contact[Contact Type] = "General Manager" && Contact[Store] = SELECTEDVALUE('General Info'[Column1])))
    RETURN 
    IF(ISBLANK(temp), "N/A", temp)
    
    General Manager Phone = 
    VAR temp = CALCULATE(MAX(Contact[Phone]), FILTER(Contact, Contact[Contact Type] = "General Manager" && Contact[Store] = SELECTEDVALUE('General Info'[Column1])))
    RETURN 
    IF(ISBLANK(temp), "N/A", temp)
    

     

     

    You may refer to the appendix.

     

    Community Support Team _ Jimmy Tao

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