Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi everyone. I've got this table:
My purpose is to calculate the number of Pieces Produced Today, given by the maximum of pieces produced today minus the maximum of pieces produced in the previous date, that might not be the day immediately preceding.
Can you help me? Thanks in advance. Here is the PBIX file: https://www.dropbox.com/s/2h9avwap7xy2qw1/Production%20order.pbix?dl=0
Solved! Go to Solution.
This should get you the value from the previous date. You can then work out the subtraction. Please test with more products and different date setups.
NewColumn = VAR _prodID = Query[ProdID]
VAR _date = Query[Date]
VAR _fromDate = CALCULATE(MAX(Query[Date]), FILTER(Query, Query[Date] < _date && Query[ProdID] = _prodID))
RETURN
CALCULATE(MAX(Query[MaxProducedPcsToday]), FILTER(Query, Query[Date] = _fromDate && Query[ProdID] = _prodID))
This should get you the value from the previous date. You can then work out the subtraction. Please test with more products and different date setups.
NewColumn = VAR _prodID = Query[ProdID]
VAR _date = Query[Date]
VAR _fromDate = CALCULATE(MAX(Query[Date]), FILTER(Query, Query[Date] < _date && Query[ProdID] = _prodID))
RETURN
CALCULATE(MAX(Query[MaxProducedPcsToday]), FILTER(Query, Query[Date] = _fromDate && Query[ProdID] = _prodID))
Thanks for help @HotChilli
I did it by creating this column:
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 17 | |
| 10 | |
| 7 | |
| 6 |