The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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:
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
20 | |
12 | |
10 | |
7 |