# Calculate a Desired Metric for the Previous Month ONLY and its Relevant Days ONLY? Calculate a Desired Metric for the Previous Month ONLY and its Relevant Days ONLY?

Explanation

1. In this requirement first we have to calculate the Latest month And Previous month. Then after we have to calculate the number of days in between those two months and the sales based on each day.

2. First we have to Drag Order date -> Rows and change YEAR to DAY.

3.Then create calculated field for the Latest Month & Previous Month. As shown below. 4. Now drag those calculated fields into row self and change YEAR to MONTH.

5. Now we have to find out the Latest DAY, as shown below. 6. Now drag the Latest Day Calculation field into rows and Change YEAR to DAY.

7. Now chose the metrics (measures) based on the requirement. Here I am taking the sales is the metrics.

8. Now I am going to write a calculated field for Previous Month to Latest day based on the sales. See the below calculation. 9. Now drag the above calculation field into rows and select the aggregation as SUM.

10. Now drag the Sales into Label (Text) self at marks card level.

11. Now the final output is shown below. 