Forum Discussion
Total monthly sales
Hello community. I am new to Power BI, I need to calculate the total amount of sales made in each month, my table is 3 months old and the sales generated in those three months. You can tell me how I can do that. Thank you
- Anonymous4 years ago
Hi Syndicate_Admin ,
I created some data:
Here are the steps you can follow:
1. Create calculated column.
Year = YEAR('Table'[Date])Month = MONTH('Table'[Date])2. Create measure.
total amount of sales made in each month = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[Month]=MAX('Table'[Month])))If you want to get the amount of all dates in the entire table, you can use the following function:
sales generated in those three months = SUMX(ALL('Table'),[Amount])If you want to get the total for a given three months:
You can use [Month] as a slicer to specify which three consecutive months.
Slicer_amount = var _min=MINX(ALLSELECTED('Table'),[Month]) var _max=MAXX(ALLSELECTED('Table'),[Month]) return CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Month]>=_min&&'Table'[Month]<=_max))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
3 Replies
- AnonymousNot applicable
Hi Syndicate_Admin ,
I created some data:
Here are the steps you can follow:
1. Create calculated column.
Year = YEAR('Table'[Date])Month = MONTH('Table'[Date])2. Create measure.
total amount of sales made in each month = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[Month]=MAX('Table'[Month])))If you want to get the amount of all dates in the entire table, you can use the following function:
sales generated in those three months = SUMX(ALL('Table'),[Amount])If you want to get the total for a given three months:
You can use [Month] as a slicer to specify which three consecutive months.
Slicer_amount = var _min=MINX(ALLSELECTED('Table'),[Month]) var _max=MAXX(ALLSELECTED('Table'),[Month]) return CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Month]>=_min&&'Table'[Month]<=_max))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
- Ashish_Mathur
Super User
Hi,
Share some data and show the expected result.
- Syndicate_Admin
Administrator
Thank you very much, I will be implementing to test it.