This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi All,
I need a bit of help, trying to solve the following problem. I have 'Table A' with products with start and end dats, i have 'Table B' with sales by product. I want to create a table c as below which shows the the number of times a product appears in table a where the sales date from table b is between the start date and end date in table a.
I am using the following but it returns the results ignoring the product, results shown in table d:
Table A:
| product | start Date | end date |
| long | 01/03/2019 | 08/03/2019 |
| long | 01/03/2019 | 08/03/2019 |
| medium | 01/03/2019 | 08/03/2019 |
| medium | 01/03/2019 | 08/03/2019 |
| medium | 01/03/2019 | 08/03/2019 |
| short | 08/03/2019 | 15/03/2019 |
| long | 08/03/2019 | 15/03/2019 |
| short | 12/03/2019 | 19/03/2019 |
| medium | 08/03/2019 | 15/03/2019 |
| medium | 15/03/2019 | 22/03/2019 |
Table b
| sales date | amount | Product |
| 03/03/2019 | 120 | long |
| 03/03/2019 | 150 | long |
| 10/03/2019 | 165 | short |
| 17/03/2019 | 195 | |
| 24/03/2019 | 210 | |
| 31/03/2019 | 240 |
Table C:
| sales date | amount | Product | number |
| 03/03/2019 | 120 | long | 2 |
| 03/03/2019 | 150 | long | 2 |
| 10/03/2019 | 165 | short | 1 |
| 17/03/2019 | 195 | ||
| 24/03/2019 | 210 | ||
| 31/03/2019 | 240 |
table d:
| 3 March 2019 | 120 | long | 5 |
| 3 March 2019 | 150 | long | 5 |
| 10 March 2019 | 165 | short | 3 |
| 17 March 2019 | 195 | 2 | |
| 24 March 2019 | 210 | ||
| 31 March 2019 | 240 |
Solved! Go to Solution.
So I did the following. PBIX attached.
Table C =
ADDCOLUMNS(
'Table B',
"number",COUNTROWS(
FILTER(
'Table A',
'Table B'[Product] = 'Table A'[product] &&
'Table B'[sales date] >= 'Table A'[start Date] &&
'Table B'[sales date] <= 'Table A'[end date]
)
))
So I did the following. PBIX attached.
Table C =
ADDCOLUMNS(
'Table B',
"number",COUNTROWS(
FILTER(
'Table A',
'Table B'[Product] = 'Table A'[product] &&
'Table B'[sales date] >= 'Table A'[start Date] &&
'Table B'[sales date] <= 'Table A'[end date]
)
))
this works perfect. thank you
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 31 | |
| 25 | |
| 21 | |
| 18 | |
| 17 |
| User | Count |
|---|---|
| 62 | |
| 34 | |
| 33 | |
| 25 | |
| 24 |