Forum Discussion
Card Visual to return value matching slicer selection
- 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.
Hi v-yuta-msft , thanks again for your help! However, it seems to work in your file but not mine.
Here is the link to my pbi file. Please can you check what's wrong with it that the calculated column didn't give me the right result like in the pic you posted. My calculated column and yours are completely identical.
Thanks so muchhhh!
trdoan ,
Use measures:
Phone Number = CALCULATE(LASTNONBLANK(Contact[Phone], TRUE()), ALLEXCEPT(Contact, Contact[Store], Contact[Name]))or
Phone Number = CALCULATE(MAX(Contact[Phone]), ALLEXCEPT(Contact, Contact[Store], Contact[Name]))instead.
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.
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.