hey Guys,
in this superstore example am trying to create a Metric to display Month over month profit growth based on the selected month for the selected parameter year i created. the issue is how do i display the prior month profit as my year is in parameter and my month is in date format ?
i want the user to be able to select/filter by year and specific OR all months to see a full year total.
my current month profit is:
if [Order Date (Years)]=[Parameter Year] THEN [Profit] END
what i need is let say a user selects Parameter year: 2020 and Month: February.. i want to see the Prior Months profit Profit. so Jan 2020.
Add an "All" option.
Then change the calcs as follows:
Profit - Current
// Profit for the selected month & year.
IF [Parameter Month]=0 THEN
IF YEAR([Order Date]) = [Parameter Year] THEN
[Profit]
ELSE
0
END
ELSE
IF DATETRUNC('month', [Order Date]) = [Date - Current] THEN
[Profit]
ELSE
0
END
END
Profit - Previous
// Profit for the previous month.
IF [Parameter Month]=0 THEN
IF YEAR([Order Date]) = [Parameter Year]-1 THEN
[Profit]
ELSE
0
END
ELSE
IF DATETRUNC('month', [Order Date]) = [Date - Previous] THEN
[Profit]
ELSE
0
END
END