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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rnd2789
New Member

Identify consecutive dates in the same column with regard to respective IDs

Greetings everyone. I have recently started using PBI and have been stuck with identifying consecutive dates problem for days. Please suggest something if any solutions or ideas.

I have a table with columns (example dataset Mock_PBI (1).xlsx) - date of Purchase, Product ID, Product Price, and Product Number.

I am working on finding consecutive dates (+ 1 day and -1 day) for each Product ID and then summing up the product price for those dates. I have tried using the next day function for identifying +/- 1 day in a column but it only works correctly for the dataset with a single Product ID and not for multiple IDs.  

For instance, this is the table I have :

rnd2789_0-1663643391783.png

 

And This is the table I wish to achieve with a new column (Final Price) with calculated prices based on the consecutive dates for each product ID:

rnd2789_1-1663643891142.png

 

 

Please note that I have a very big dataset and the dataset here is a made-up small example set. 

it would be a great help if there are any suggestions for the problem.

Thank You

 

2 REPLIES 2
Anonymous
Not applicable

Hi @rnd2789 ,

 

If you have a table with three consecutive days of data, then this problem becomes very simple. As shown in the figure below:

 

vmengzhumsft_0-1662963975726.png

 

Measure = CALCULATE(SUM(Sheet1[Product price]),FILTER(ALL(Sheet1),'Sheet1'[product ID]=SELECTEDVALUE(Sheet1[product ID])))

In your example data, only when the previous day's data values are available, you may need to consolidate the data for better calculations.

 

Best regards,

Community Support Team Selina zhu

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

Hi, Thanks for the solution. 

However, the problem when taking this approach is that, For a product ID, all the prices would be summed up.

rnd2789_0-1663643065924.png

 

The end goal is to sum only the prices with consecutive dates within a product ID. Anything you can suggest for the problem? 

Also I have made a mistake while uploading the data, actually there are only three product ID's. corrected data Mock_PBI (1).xlsx

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.