Forum Discussion
Calculate previous month's total
Hi,
I am looking to return a previous month's total in my matrices. I've looked at parallelperiod but I either don't understand the function, or it's not working in my particular setup.
I have a query with all of my data - e.g. date of trade (may be multiple trades on a date) and size of each trade in another column
I then have another query with a range of dates covering several years and various different breakdowns of the date - month name, day name, financial year month name (months ordered by financial year - i.e. July is 1 instead of 7), quarter (labelled Qtr 1, etc), etc. I have the trade date in my source data linked to the date in this query.
In my output matrices in Power Bi I use fields from the date query to summarise data. E.g. the rows of my table are Financial Month Name from the date query. I have a query that sums the trade size column and is the values in this matrix. I'm looking to build a measure that allows me to display the previous month's total trade size against a particular month.
I tried using Parallel Period as follows: Total Volume M-1 = CALCULATE(SUM('Trade Data'[Volume]),DATEADD('Date Lookup'[Trade Date].[Date],-1,month)) but when I use Financial Month Name (a column in my Date Lookup table) it just repeats the same data in the Total Volume and Total Volume M-1 column.
Can anyone suggest a function to achieve this, or explain how I'm using Parallel Period incorrectly?
Thanks
1 Reply
- AnonymousNot applicable
Jordan1,
Please check how to calculate previous month total in the attached PBIX file. If it doesn't return your expected result, please share sample data of your tables and post expected result based on the sample data.
Regards,
Lydia