Forum Discussion
subtract sales units from previous day
i had daily sales sent tom me in excel but mtd
so i need to sustract day 2 from day 1 to get real day 2
i need dax formula to subtact with date
can you help
- Anonymous4 years ago
Hi ossama_ibrahim8 ,
Is this a matrix or a table of data sources?
If it is a data source, it is best to unpivot the date in Power Query and turn the date into a separate column.Select the Item Code and Item name, click 'Unpivot Other Columns'.
You could get a column of dates and a column of values.
Now you could create the following measure to get the value from previous day.
Previous Value = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Item Code]=MAX('Table'[Item Code])&&[Attribute]=MAX('Table'[Attribute])-1))Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- AnonymousNot applicable
Hi ossama_ibrahim8 ,
It's the Power Query Forum. M language is used in it. While dax is used in Power BI Desktop.
And here's the blog teaches you how to get the value from previous row:
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- ossama_ibrahim8Regular Visitor
- AnonymousNot applicable
Hi ossama_ibrahim8 ,
Is this a matrix or a table of data sources?
If it is a data source, it is best to unpivot the date in Power Query and turn the date into a separate column.Select the Item Code and Item name, click 'Unpivot Other Columns'.
You could get a column of dates and a column of values.
Now you could create the following measure to get the value from previous day.
Previous Value = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Item Code]=MAX('Table'[Item Code])&&[Attribute]=MAX('Table'[Attribute])-1))Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- ossama_ibrahim8Regular Visitor
n=i need to subtract 3-7-2022 value with items sales from 2-7-2022 value and every day