On a report, you can change the product sale details from Days Since Sold to Last Day Sold. This calculation can be prepared from an Inventory report, for example, a Dusty Inventory report, because Days Since Sold is an included measure.
From the collection of Date Functions, you can use the Add_Days function to count backward from the current day. There are two arguments to Add_Date:
- The first argument is the number difference.
- The second argument is the date that you want to adjust. It will be similar to: (difference, start date). The function should be : (negative days since sold, today).
To change Days since sold to Last day sold:
- Start a new Table Calculation.
- In the calculator, search for and add the add_days function.
- In the brackets, insert a subtraction symbol and the last day sale function.
- Insert now() as the source date. This will add a column with the timestamps of the days since last sold, with the time frame being the current time.
- Next, change now to the date function.
- Since the date function requires three arguments (year, month, day), prepare the function by adding three sets of brackets within the existing bracket.
- Next, to find the year, month, and day from now, insert one of the functions extract_year, extract_month, and extract_day within each set of brackets.
- Insert the now() function into all three empty brackets. The final calculation should be:
add_days(-${cl_item_facts.days_since_sold},date((extract_years(now())),(extract_months(now())),(extract_days(now())))) - Save the calculation.
The table will include a new column with the results of the calculation as year, month, day, for each row.