Forum Discussion
Issue With Relationship / DAX Not Showing Correct Data
- Anonymous1 year ago
Hi Akash_Varuna ,
Thank you for reaching out to the Microsoft fabric community forum. Also thank you wardy912 for you helful response.
The behavior you observed is due to the way SELECTEDVALUE works; it only returns a single value when there is one value in the current filter context. When a conversation_id is associated with multiple topic_labels, the function will either return one value or blank, which is why you were not getting the expected results.
To address this, you can use CONCATENATEX instead, which will return all topic groups linked to the selected conversation, separated by commas:
Topic Groups = CALCULATE ( CONCATENATEX ( VALUES ( Topics[topic_group] ), Topics[topic_group], ", " ), TREATAS ( VALUES ( Messages_1[topic_label] ), Topics[topic_label] ) )Please find the attached .pbix and test it in your environment. You should now see multiple topic groups correctly displayed whenever a conversation_id maps to more than one label.
Hope this helps, please feel free to rech out for any further questions.
Thank you.
Hi Akash_Varuna
I've replicated your method with your dummy data and relationship structure, unfortunately i'm not seeing an error. Unless i've misunderstood, it's working as expected.
Topic Group =
CALCULATE(
SELECTEDVALUE(Topics[topic_group]),
TREATAS( VALUES(Messages_1[topic_label]), Topics[topic_label] )
)
Messages is driving the slicer:
The only difference with mine is it's not direct query, could that be causing an issue?
Hi wardy912 Thanks for checking, appreciate it.
The issue in my model is that a single conversation_id can have multiple topic_labels under it.
For example, the same conversation may contain both Outlier Cluster and Billing and Payment Issues. In that case, the current DAX only shows the Outlier Cluster group and blanks out the rest.
I need a way to correctly return all topic groups for the conversation.
- wardy9121 year agoSuper User
Very strange, i've added multiple topic_labels and I still have no issue with the above configuration.