Forum Discussion
NewbieJono
Post Partisan
2 years agoCalculate volume for max month
is there any method to calculate the total volume for the whole month based on the last date in a table
e.g
if the data for april went up to 27th April. i would like to calculate the volume for all dates in april.
Hi NewbieJono
You can use something like :last month sales =VARmax_Date =CALCULATE(MAX('orders'[Order Date]),REMOVEFILTERS('Calendar'))RETURNCALCULATE([total_sales],YEAR('Calendar'[Date])= year(max_Date) && month('Calendar'[Date])= month(max_Date))the pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
2 Replies
- Alex87
Solution Sage
Hello NewbieJono ,
Please try the following DAX measure:
TotalVolumeForMonth = VAR _LastDateInMonth = MAX('Table'[Date]) // Assuming 'Date' is your date column and it is properly formatted as a date. VAR _StartOfMonth = STARTOFMONTH('Table'[Date]) VAR _Result = CALCULATE( SUM('Table'[Volume]), 'Table'[Date] >= _StartOfMonth && 'Table'[Date] <= _LastDateInMonth ) RETURN _ResultIf it satisfies your needs, please do not forget to mark my reply as the solution. Cheers!
- Ritaf1983
Super User
Hi NewbieJono
You can use something like :last month sales =VARmax_Date =CALCULATE(MAX('orders'[Order Date]),REMOVEFILTERS('Calendar'))RETURNCALCULATE([total_sales],YEAR('Calendar'[Date])= year(max_Date) && month('Calendar'[Date])= month(max_Date))the pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.