Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

DAX expression needed to create calculated column where vLookup kind of functionality is needed

Need help in classifying data in a Calculated Column using DAX. Below is How my data looks:                                Unique Data - This data is unique and only one of it wil...
  • v-robertq-msft's avatar
    5 years ago

    Hi, Anonymous 

    According to your description and sample data, I can clearly understand your requirement, I think you can try to create a calculated column like this to achieve your requirement:

    Output =
    var _parentdate=SELECTCOLUMNS(FILTER('Table',NOT(ISBLANK([Parent Data]))),"1",[Parent Data])
    return
    SWITCH(
        TRUE(),
        ISBLANK([Parent Data]),"Parent",
        [Unique Data] in _parentdate,"Parent",
        NOT([Unique Data] in _parentdate),"Child",
        BLANK())
    
    

    And you can get what you want, like this:

     

    You can download my test pbix file below

     

    If this you still have a problem, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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