cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IliasKatsis
Frequent Visitor

Check if a product was bought in promo or not

Hello everyone,

 

I have a dataset with receipts. Each line have a receipt date, a user id which represents ther person who enter the receipt in the system, a receipt id and the general information about every product ( Category id , product id , brand id etc), another fact is that wer know the retailer for every receipt. Every line represents a single product, a sample of the data is like this data.jpg

 

Now i have another table, which represents promo data and is like this:

IliasKatsis_1-1679958278161.png

 

The objective is to combine this two tables. I want to check that if a product in a specific receipt date was bought in promo or not.

The statements is that the
1.receipt date must be inside the start and end date of the promo

2. the retailer id of the receipt is thr same with the promo

3. of course the product id must be the same in both tables.

 

Please help me

Thanks

1 ACCEPTED SOLUTION
littlemojopuppy
Super User
Super User

That would be a really large table.  Instead of combining tables, try creating a measure to determine if a receipt qualifies.

Two steps:

  1. FILTER() promo for where Retailer ID matches on both tables, Product ID matches, and receipt date >= promo start date and <= promo end date. 
  2. Use COUNTROWS() on that.

If COUNTROWS > 1 then you know it was bought in a promo.

 

Hope this helps!

View solution in original post

3 REPLIES 3
littlemojopuppy
Super User
Super User

@IliasKatsis glad I could help!

IliasKatsis
Frequent Visitor

Thanks! Very good!

littlemojopuppy
Super User
Super User

That would be a really large table.  Instead of combining tables, try creating a measure to determine if a receipt qualifies.

Two steps:

  1. FILTER() promo for where Retailer ID matches on both tables, Product ID matches, and receipt date >= promo start date and <= promo end date. 
  2. Use COUNTROWS() on that.

If COUNTROWS > 1 then you know it was bought in a promo.

 

Hope this helps!

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors