Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi guys,
I am trying to create a report on Power BI but can't pin the right way although the goal seems very simple.
Here is my sample data below. I want to create a measure that will do the sum of quantity for the next day (and eventually date +2 and date +3). So I am looking somewhat to override the filter on the date and apply next day instead.
I simplified the sample to two dimensions but I would eventually have more (product category, supplier..)
Sample:
| Date | Name | Quantity |
| 01/01/2017 | A | 5 |
| 01/01/2017 | A | 5 |
| 01/01/2017 | B | 5 |
| 02/01/2017 | A | 1 |
| 02/01/2017 | A | 2 |
| 02/01/2017 | B | 2 |
| 02/01/2017 | B | 3 |
What I am trying to achieve:
| Date | Name | Sum(Qty) | Sum(Next_Day_Qty) |
| 01/01/2017 | A | 10 | 3 |
| 01/01/2017 | B | 5 | 5 |
| 02/01/2017 | A | 3 | |
| 02/01/2017 | B | 5 |
Thanks
Solved! Go to Solution.
NextDay Totals = CALCULATE ( SUM ( 'Table'[Quantity] ), DATEADD ( 'Calendar'[Date], +1, DAY ) )
You can use the DATEADD-function to shift your Date-filters forward or backward:
https://msdn.microsoft.com/en-us/library/ee634905.aspx
This requires a separate calendar-table (DateTime), which is one of the best practices for PBI like described here: http://exceleratorbi.com.au/best-practices-power-pivot-power-query-power-bi/
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
NextDay Totals = CALCULATE ( SUM ( 'Table'[Quantity] ), DATEADD ( 'Calendar'[Date], +1, DAY ) )
Sean I believe your solution is close to what I am looking for.
I have written the formulas as :
Note that I am using the same table for Quantity and Date. It works like a charm with the current sample, I have tried to add one product C with non following date for test:
It looks fine at first
But when I filter C I get this message
Fair enough, I have tried to add a calendar table relating to Product table and changed the measure to:
The measure looks like a simple Sum(Quantity)
Replace Product[Date] in the Table Visual with Calendar[Date] ![]()
Thanks Sean it was simple as that!
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 38 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 30 | |
| 26 | |
| 25 |