Use if Location = "', True, else A2:A7=G2, Same as others.
Here is an sample.
=FILTER(A2:D7,(IF(G2="",1,A2:A7=G2))*(IF(G3="",1,B2:B7=G3))*(IF(G4="",1,C2:C7=G4))*(IF(G5="",1,D2:D7=G5)))

Many thanks for you response @Snow Lu MSFT but it did not work with my data.
I have a list of items and I want them to work with all these fields. I can share a file which I am using if that can help you.
Here is my code which works with my the first condition only. Rest works with this formula if I keep all the fields filled up. But I want any or all of the feilds criteria to show me results as expected.
=SORT(UNIQUE(IF(D2="",TAKE('Data-Mar-23'!B3:N1048576,'Data-Mar-23'!BK2),FILTER('Data-Mar-23'!B:N,(('Data-Mar-23'!N:N=D2)*('Data-Mar-23'!F:F=D3)*('Data-Mar-23'!M:M=D4)*('Data-Mar-23'!L:L=D5)*('Data-Mar-23'!C:C=D6))))))
Here is the link of the file which you can access to help me: Sample.xlsx See the sheet named Sample where I have applied the formula.