Forum Discussion
Visualization: stock differences between days
- 9 years ago
Hi Jaromir,
You could create calculated measure for "Total sales to previous date":
Prev Sales = CALCULATE(SUM(Sales[Sales]),PREVIOUSDAY(Sales[Date]))
Create calculated measure for stock differences between days:
stock differences between days = sum(Sales[Sales])- [Prev Sales]
If this works for you please accept it as solution and also like to give KUDOS.
Best regards
Tri Nguyen
Hi Jaromir,
What is meaning of differences between days, could you show me 1 example for that logic? so i could understand it correctly.
Hi,
I basically need to calculate a difference in stock amount for a selected product_id between two consecutive dates.
Say the stock amount on Feb 1 is 43, on Feb 2 it is 38. I need to add a column which would calculate that the difference in stock between those two days is -5. And I need to do the same for every row (date).
Thanks!
- tringuyenminh929 years agoMemorable Member
Hi Jaromir,
You could create calculated measure for "Total sales to previous date":
Prev Sales = CALCULATE(SUM(Sales[Sales]),PREVIOUSDAY(Sales[Date]))
Create calculated measure for stock differences between days:
stock differences between days = sum(Sales[Sales])- [Prev Sales]
If this works for you please accept it as solution and also like to give KUDOS.
Best regards
Tri Nguyen- Jaromir9 years agoFrequent Visitor
Hi tringuyenminh92,
thanks for your response. I have created a calculated measure as you suggested:
PrevStock = CALCULATE(SUM('data'[stock]); PREVIOUSDAY('data'[date]))But it only returns empty field. I have checked and there is a row with a previous day date. What could I be doing wrong?
Thanks again.
- Jaromir9 years agoFrequent Visitor
I found the problem, had to use PREVIOUSDAY('data'[date].[Date]).