Hi fsotiros,
Welcome to the QuickSight community.
One possible way to accomplish this is using QuickSight free form layout with 2 tables visuals.
Table 1— with column A, C, D
Table 2 — with column B,E
Depending on parameter value of p show only one of the table. As demonstrated in the following Community question Hide visual based on filters - #4 by robdhondt