Forum Discussion
Current Quarter and last quarter calculation
- 7 years ago
Hi Anonymous ,
You can create Quarter column first of all.
Quarter = ROUNDUP(MONTH(Table1[Date])/3,0)
Then create measures to get the current quarter total sales and last quarter total sales.
Total sales_current quarter = CALCULATE(SUM(Table1[sale]),FILTER(ALLSELECTED(Table1), Table1[Quarter] =MAX(Table1[Quarter])))
Total sales_last quarter = CALCULATE(SUM(Table1[sale]),FILTER(ALLSELECTED(Table1), Table1[Quarter] =MAX(Table1[Quarter])-1))
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous7 years ago
Hi Anonymous ,
You can make this small change to the Quarter computation
Quarter =Year(Table1[Date])*4 + ROUNDUP(MONTH(Table1[Date])/3,0)
What this will result is a running serial number for the quarters from 8069 for Jan - March 2017 - 1st quarter and so on until 8079 - for Apr-May 2019 - 2 quarter.
Use the formula as suggested by v-xicai for current quarter and previous quarter. It will work.
Check it out.
Cheers
CheenuSing
Hi Anonymous ,
You can create Quarter column first of all.
Quarter = ROUNDUP(MONTH(Table1[Date])/3,0)
Then create measures to get the current quarter total sales and last quarter total sales.
Total sales_current quarter = CALCULATE(SUM(Table1[sale]),FILTER(ALLSELECTED(Table1), Table1[Quarter] =MAX(Table1[Quarter])))
Total sales_last quarter = CALCULATE(SUM(Table1[sale]),FILTER(ALLSELECTED(Table1), Table1[Quarter] =MAX(Table1[Quarter])-1))
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
You can make this small change to the Quarter computation
Quarter =Year(Table1[Date])*4 + ROUNDUP(MONTH(Table1[Date])/3,0)
What this will result is a running serial number for the quarters from 8069 for Jan - March 2017 - 1st quarter and so on until 8079 - for Apr-May 2019 - 2 quarter.
Use the formula as suggested by v-xicai for current quarter and previous quarter. It will work.
Check it out.
Cheers
CheenuSing
- Anonymous5 years agoNot applicable
This solved the issue of having quarters from different years.
Ex: Q1-2019 & Q1-2020. Using the solution marked in this post, will result in a overlap of both values from these quarters, since we're only looking for the Quarter number. By creating a serialized number, we avoid this overlap, since each quarter has a unique key.