Forum Discussion

IliasKatsis's avatar
IliasKatsis
Icon for Helper I rankHelper I
4 years ago
Solved

Check if some ids are inside a campaign

Hello,  I have this model and I want to check if some coupon ids from transactions table are included in some campaigns from the campaign details table. Each campaign has a unique id and has s...
  • v-xiaotang's avatar
    v-xiaotang
    4 years ago

    Hi IliasKatsis 

    Thanks for your screenshots. 

    The known conditions are,
    1. You want to get the description from the campaigns table and put it into the Transcation table,
    2. Use the date of the Transcation table to filter the campaigns table,
    3. Use the coupon_id of the Transcation table to filter the Campaign details, and then you want to filter the campaigns table by this
    one idea is 

    Current Camp = 
    var _t1=SELECTCOLUMNS(FILTER(ALL('Campaign details'),'Campaign details'[Coupon ID]= MIN(Transactions[coupon_id])),"s",[Campaign ID])
    return 
    MAXX (
        FILTER (
            Campaigns,
            Campaigns[StartDate]<=MIN(Transactions[Transaction Date] )
                && Campaigns[EndDate]>=MIN(Transactions[Transaction Date])&& Campaigns[Campaign ID] in _t1
        ),
        Campaigns[Description]
    )

    result (based on my sample)

     

    Best Regards,

    Community Support Team _Tang

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