Forum Discussion

seba's avatar
seba
Helper II
2 years ago
Solved

Power BI Model Question

Hi! Hope all is well! Here is the challenge I am facing and looking for help with – I do have the below reference table with people names and fruits they would like to get. Each person is “satisfied”...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi seba ,

    I understand your requirement and I think you can change your table and use this DAX code. Here is a similar example.

    Measure 3 = 
    VAR _Slicer = VALUES('T2'[Car Name])
    VAR _vtable = ADDCOLUMNS(GENERATE('T1',_Slicer),"AAA",IF(FIND('T2'[Car Name],'T1'[Name],,BLANK())<>BLANK(),'T2'[Car Name]))
    VAR _vtable2 = SUMMARIZE (
            _vtable,
            [Name],
            "BBB",
                IF (
                    LEN ( CONCATENATEX ( _Slicer, 'T2'[Car Name] ) )
                        = LEN ( CONCATENATEX ( FILTER ( _vtable, 'T1'[Name] = EARLIER ( 'T1'[Name] ) ), [AAA] ) ),
                    CONCATENATEX ( FILTER ( _vtable, 'T1'[Name] = EARLIER ( 'T1'[Name] ) ), [AAA] )
                )
        )
    RETURN
    IF (
            CONCATENATEX ( FILTER ( _vtable2, [Name] = 'T1'[Name] ), [BBB] )
                <> BLANK (),
            CONCATENATEX ( FILTER ( _vtable2, [Name] = 'T1'[Name] ), [BBB] )
        )

     

     

    Best Regards

    Yilong Zhou

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