Filtering Data based on ReferenceField

First, you don’t need to user .include() or .queryReferenced() if you do not intend to use the data inside the reference item in the referenced collection, if it is just a filter by the field (reference field or not), you can use .eq().

This would work, I guess, cause I have not tested yet.

import wixUsers from "wix-users"
import wixData from "wix-data"

let user = wixUsers.currentUser
let userId = user.id
let isLoggedIn = user.loggedIn

$w.onReady(async () => {

 let table = $w("#table1") //Change this to your table element ID.

 let filterDataRelatedUser = await queryDataRelatedUser(userId)

 if (filterDataRelatedUser.length > 0) {
        table.rows = filterDataRelatedUser
 } else {
        console.log("No related user found!")
 }
})

async function queryDataRelatedUser(userId) {
 let results = wixData.query("client-records").eq("relatedUser", userId).find()
 return results.items
}