You’re on the right track attempting to chain filter statements together, but there is a syntax issue with the above. Try this approach instead.
let ram,storage;
let filter = wixData.filter();
ram = $w("#category").value;
storage= $w("#brand").value;
if (ram){
filter = filter.contains("ram", ram);
}
if (storage){
filter = filter.contains("storage",storage);
}
$w("#dataset1").setFilter(filter)
.then(() => {
console.log("Dataset is now filtered.");
})