Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
erikzzy
Helper II
Helper II

Need Help to new measure or/and column by comnbine 2 tables

Hello everyone,

I have 2 tables. I want that have the 3rd table by adding measure or column. But my measure doesn't work.

Thanks for your help.

My measure:

 

Measure =
var X = SELECTEDVALUE(Table2[id])
return
SELECTCOLUMNS(FILTER(Table1,Table1[id]=X),"new_column",Table1[response])
 
Table1.

erikzzy_0-1594784967258.png

Table 2. 

erikzzy_1-1594785006837.png

Table 3I want to have.

erikzzy_3-1594785102938.png

 

1 ACCEPTED SOLUTION

See if this works for you:

1.PNG

Table 2 =
ADDCOLUMNS (
    Table2,
    "c", RELATED ( Table1[Response] ),
    "n",
    VAR A =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[ID] = Table2[ID] ),
            "1", Table1[Report ID]
        )
    VAR B =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[Report ID] = A && Table1[Type Question] = "n" ),
            "2", Table1[Response]
        )
    RETURN
        B,
    "P",
    VAR A =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[ID] = Table2[ID] ),
            "1", Table1[Report ID]
        )
    VAR B =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[Report ID] = A && Table1[Type Question] = "p" ),
            "2", Table1[Response]
        )
    RETURN
        B
)

View solution in original post

5 REPLIES 5
AntrikshSharma
Super User
Super User

Try this:

=
ADDCOLUMNS ( Table2, "c", RELATED ( Table1[Response] ) )

regarding the other 2 columns n & p, what is the logic? 

Thanks your reply.

For the n and p : in the table 1, every report_id represents one record. For example (report_id = aaa), there a one blue(c) secondhand(p) car Nissan (n). I want to have these 3 features in one line in table3.  If some feature is no recorded, we substitute par No Value ( blank() ) .

Thanks one more time, 

See if this works for you:

1.PNG

Table 2 =
ADDCOLUMNS (
    Table2,
    "c", RELATED ( Table1[Response] ),
    "n",
    VAR A =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[ID] = Table2[ID] ),
            "1", Table1[Report ID]
        )
    VAR B =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[Report ID] = A && Table1[Type Question] = "n" ),
            "2", Table1[Response]
        )
    RETURN
        B,
    "P",
    VAR A =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[ID] = Table2[ID] ),
            "1", Table1[Report ID]
        )
    VAR B =
        SELECTCOLUMNS (
            FILTER ( Table1, Table1[Report ID] = A && Table1[Type Question] = "p" ),
            "2", Table1[Response]
        )
    RETURN
        B
)

Thanks your reply. its works!

Replace Table 2(name) at the top with Table 3 to avoid confusion.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.