Forum Discussion
DATEADD not calculating
I have an imported excel workbook "Inventory Summary" and I also have a Calendar Table. However, I cant get this code to work. Any help would be awesome.
- Anonymous3 years ago
Hi pattie_2022 ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Hardware Inventory Previous Month = var _lastmonth=DATE(YEAR(MAX('Inventory Summary xls'[Date])),MONTH(MAX('Inventory Summary xls'[Date]))-1,DAY(MAX('Inventory Summary xls'[Date]))) return SUMX(FILTER(ALL('Inventory Summary xls'), 'Inventory Summary xls'[Date]>=_lastmonth&&'Inventory Summary xls'[Date]<=MAX('Inventory Summary xls'[Date])&& 'Inventory Summary xls'[Description]="Hardware"),[Value])2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
2 Replies
- Ashish_Mathur
Super User
Hi,
Try these measures
Inventory = SUM('Inventory Summary xls'[Value])
Hardware inventory = calculate([Inventory],'Inventory Summary xls'[Description] = "Hardware")
Hardware inventory in PM = calculate([Hardware inventory],previousmonth(calendar[date]))
Ensure that to your visual/filters/slicer, you drag Year and/or Month name from the Calendar Table.
Hope this helps.
- AnonymousNot applicable
Hi pattie_2022 ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Hardware Inventory Previous Month = var _lastmonth=DATE(YEAR(MAX('Inventory Summary xls'[Date])),MONTH(MAX('Inventory Summary xls'[Date]))-1,DAY(MAX('Inventory Summary xls'[Date]))) return SUMX(FILTER(ALL('Inventory Summary xls'), 'Inventory Summary xls'[Date]>=_lastmonth&&'Inventory Summary xls'[Date]<=MAX('Inventory Summary xls'[Date])&& 'Inventory Summary xls'[Description]="Hardware"),[Value])2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly