I require a line graph that shows the CY and PY values based on the FISCAL year slicer selected on the top. It is showing me only CY values but not the PY values. If I selected the prior year (2023), I can see the PY graph. I want to see the PY values even without 2023 year being selected.
Digital ToGo Avg Ticket PY Chart =
VAR SELECTED_DATE = IF(MAX(DATE_DIM_Fiscal[CALENDAR_DATE])>=TODAY(),TODAY()-1,MAX(DATE_DIM_Fiscal[CALENDAR_DATE]))
VAR END_PERIOD_PY =
LOOKUPVALUE(
DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY],
DATE_DIM_Fiscal[CALENDAR_DATE],
SELECTED_DATE
) -52
VAR START_PERIOD_PY = END_PERIOD_PY - 12
VAR NUMERATOR =
CALCULATE(
SUMX(
FILTER(
FACTTABLE,
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) >= START_PERIOD_PY &&
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) <= END_PERIOD_PY
),
FACTTABLE[NET_SALES]
),
KEEPFILTERS(
FILTER(
FACTTABLE,
RELATED(Order_Dim[ORDER_CHANNEL]) = "Digital" &&
RELATED(Order_Dim[ORDER_OCCASION]) = "ToGo"
)
),
REMOVEFILTERS (
DATE_DIM_Fiscal[FISCAL_YEAR],
DATE_DIM_Fiscal[QUARTER_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[MONTH_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[FISCAL_WEEK_NUMBER_YEAR]
)
)
VAR DENOMINATOR =
CALCULATE(
SUMX(
FILTER(
FACTTABLE,
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) >= START_PERIOD &&
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) <= END_PERIOD
),
FACTTABLE[Transaction_Count]
),
KEEPFILTERS(
FILTER(
FACTTABLE,
RELATED(Order_Dim[ORDER_CHANNEL]) = "Digital" &&
RELATED(Order_Dim[ORDER_OCCASION]) = "ToGo"
)
),
REMOVEFILTERS (
DATE_DIM_Fiscal[FISCAL_YEAR],
DATE_DIM_Fiscal[QUARTER_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[MONTH_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[FISCAL_WEEK_NUMBER_YEAR]
)
)
RETURN DIVIDE(NUMERATOR, DENOMINATOR)
Digital ToGo Avg Ticket CY Chart =
VAR SELECTED_DATE = IF(MAX(DATE_DIM_Fiscal[CALENDAR_DATE])>=TODAY(),TODAY()-1,MAX(DATE_DIM_Fiscal[CALENDAR_DATE]))
VAR END_PERIOD =
LOOKUPVALUE(
DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY],
DATE_DIM_Fiscal[CALENDAR_DATE],
SELECTED_DATE
)
VAR START_PERIOD = END_PERIOD - 12
VAR NUMERATOR =
CALCULATE(
SUMX(
FILTER(
FACTTABLE,
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) >= START_PERIOD &&
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) <= END_PERIOD
),
FACTTABLE[NET_SALES]
),
KEEPFILTERS(
FILTER(
FACTTABLE,
RELATED(Order_Dim[ORDER_CHANNEL]) = "Digital" &&
RELATED(Order_Dim[ORDER_OCCASION]) = "ToGo"
)
),
REMOVEFILTERS (
DATE_DIM_Fiscal[FISCAL_YEAR],
DATE_DIM_Fiscal[QUARTER_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[MONTH_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[FISCAL_WEEK_NUMBER_YEAR]
)
)
VAR DENOMINATOR =
CALCULATE(
SUMX(
FILTER(
FACTTABLE,
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) >= START_PERIOD &&
RELATED(DATE_DIM_Fiscal[FISCAL_YEAR_WEEK_NUMBER_KEY]) <= END_PERIOD
),
FACTTABLE[Transaction_Count]
),
KEEPFILTERS(
FILTER(
FACTTABLE,
RELATED(Order_Dim[ORDER_CHANNEL]) = "Digital" &&
RELATED(Order_Dim[ORDER_OCCASION]) = "ToGo"
)
),
REMOVEFILTERS (
DATE_DIM_Fiscal[FISCAL_YEAR],
DATE_DIM_Fiscal[QUARTER_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[MONTH_NO_FISCAL_YEAR],
DATE_DIM_Fiscal[FISCAL_WEEK_NUMBER_YEAR]
)
)
RETURN DIVIDE(NUMERATOR, DENOMINATOR)

If I select 2023 also on the slicer, I get this but just by selecting 2024, I want the below graph to be displayed.

DATE_DIM_Fiscal = DATE_DIM
DATE_DIM = DATE_DIM_View
With the fact table, they are joined to many relationships with the DATE_KEY.
Even, if I change it to the the Matrix, I cannot view the values. Something is wrong with the DAX. Can someone help me with the issue?
@Ashish_Mathur @lbendlin @rajendraongole1 @Ritaf1983 @amitchandak @Kedar_Pande