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
RadhakrishnaE
Frequent Visitor

Need Dax for below logic

Hi All,

I have a requireement like

If table1.columnA = table2.columnB then i want to print Table1.columnc

 

Thanks in advance

 

 

6 REPLIES 6
Fsciencetech
Helper III
Helper III

Try Below DAX  By creating NewTable

1.   ADDCOLUMNS (
    Lookup1,
    "CheckPerson",
        VAR Person = Lookup1[Commission Person]
        VAR _Id = Lookup1[Pid]
        RETURN
            LOOKUPVALUE (
                Lookup2[Commission Person],
                Lookup2[Commission Person], Person,
                Lookup2[     Polid  ], _Id
            )
)

 

2.

GENERATE(
    Lookup1,
    VAR Person = Lookup1[Commission Person]
    VAR _Id = Lookup1[Pid]
    RETURN
        CALCULATETABLE (
            SELECTCOLUMNS ( Lookup2, "CheckPerson", Lookup2[Commission Person] ),
            Lookup2[Commission Person] = Person,
            Lookup2[     Polid  ]= _Id
        )
)

 

3.

GENERATE (
    Lookup1,
    VAR Person = Lookup1[Commission Person]
    VAR _Id = Lookup1[Pid]
    RETURN
        CALCULATETABLE (
            SELECTCOLUMNS ( Lookup2, "CheckPerson", Lookup2[Commission Person] ),
            TREATAS ( { Person }, Lookup2[Commission Person] ),
            TREATAS ( { _Id }, Lookup2[     Polid  ] )
        )
)

 

4. 

VAR FirstTable =
    SELECTCOLUMNS (
        Lookup1,
        "InId", Lookup1[InId],
        "Commission Person", Lookup1[Commission Person] & "",
        "Pid", Lookup1[Pid] & "",
        "Amount", Lookup1[Commission amount]
    )
VAR SecondTable =
    SELECTCOLUMNS (
        Lookup2,
        "Pid", TRIM ( Lookup2[     Polid  ] & "" ),
        "Commission Person", Lookup2[Commission Person] & "",
        "CheckPerson", Lookup2[Commission Person]
    )
RETURN
    NATURALLEFTOUTERJOIN ( FirstTable, SecondTable )

 

 

5.

GENERATE (
    Lookup1,
    VAR Person = Lookup1[Commission Person]
    VAR _Id = Lookup1[Pid]
    RETURN
        CALCULATETABLE (
            ROW ( "CheckPerson", VALUES ( Lookup2[Commission Person] ) ),
            Lookup2[Commission Person] = Person,
            Lookup2[     Polid  ] = _Id
        )
)

 

 

 

Fsciencetech
Helper III
Helper III

 What should be the output table?

Expected Output

InNoCommission personCommission AmountPid
In1Agency10P1
In2Agency40P2
In3broker50P3

 

Fsciencetech
Helper III
Helper III

Please send sample data to understand your requirement.

Table 1

InIdPidCommission PersonCommission amount
In1P1Agency10
In2P1broker20
In3P2Executive30
In4P2Agency40
In5P3Broker50

 

Table2

PolTid     Polid  Commission Person
PolT1      P1Agency
PolT2    P1Broker
PolT3    P1Executive
PolT4    P2Agency
PolT5    P3Agency
PolT6    P3Broker
PolT7    P3Executive

 

Condition is if Table1.commission person = table2.commission person then i want to print Table1.Commission amount

 

for that i am trying lookupvalue(table1.Commission amount,table1.commission person,table2.commission person)

 

but getting failed, i want to apply condition on commission person only

 

Thanks in Advance.

Hi @RadhakrishnaE ,

you can use the measure below:

YourMeasure =
VAR c_polid = SELECTEDVALUE ( 't1-2'[Polid] )
VAR c_commperson = SELECTEDVALUE ( 't1-2'[Commission Person] )
RETURN
    CALCULATE (
        MAX ( 't1-1'[Commission amount] ),
        't1-1'[Commission Person] = c_commperson,
        't1-1'[Pid] = c_polid
    )

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

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

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.

Top Solution Authors