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.
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.
- trdoan7 years agoHelper III
Hi v-yuta-msft , thanks for your help and everything worked perfectly!
However, may I ask another question. I noticed in my real data there's chance where a person might hold different titles and his/her information might be left blank in any other positions but the first one. Is there a way to fill in the same kind of information provided in the first postion?
Store Contact Type Name Phone B Primary Customer Service Olly 547-5 B Secondary Customer Service Olly I have removed the phone number in the Secondary Customer Service in my Sample Data to imitate the scenario. Is there a way to get those measures you've written for me to return automatically the same phone number for all positions that Olly (or anyone) holds if they're left blank?
Thank you so so much!
- v-yuta-msft7 years agoCommunity Support
trdoan ,
Just create a new calculate column like below and use the new calculate column in measures above:
Phone Number = CALCULATE(FIRSTNONBLANK(Contact[Phone], Contact[Phone]), ALLEXCEPT(Contact, Contact[Store], Contact[Name]))
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.
- trdoan7 years agoHelper III
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!