Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
3 years ago

Power Bi does not filter unique values with the DISTINC function

Hello good day to the Power Bi community.

I have the following problem: I am getting the lost customers in a priodo, based on a single folic, filter every year, then together and filter again to get the lost customers in the whole priodo; at the end he made DISTINC to remove the repeated, and count. The strangest thing is that the "card" gives me the correct value of unique, but when I put it in "table" it keeps showing me repeated.

The formula is as follows:

Lost Customers 2020-2023 =
WHERE YearMax = (.MAX(Calendar[Year]))
WHERE ClientesRecurrentes =
CALCULATETABLE(VALUES('Tuition'[Tuition]),Calendar[Year] = YearMax)
WHERE ClientesPerdidos2022 =
CALCULATETABLE(VALUES('Tuition'[Tuition]),Calendar[Year] = YearMax-1)
WHERE ClientesPerdidos2021 =
CALCULATETABLE(VALUES('Tuition'[Tuition]),Calendar[Year] = YearMax-2)
WHERE ClientesPerdidos2020 =
CALCULATETABLE(VALUES('Tuition'[Tuition]),Calendar[Year] = YearMax-3)
WHERE Crossing =
EXCEPT(ClientesPerdidos2022,ClientesRecurrentes)
WHERE Cruce1 =
EXCEPT(ClientesPerdidos2021,ClientesRecurrentes)
WHERE Cruce2 =
EXCEPT(ClientesPerdidos2020,ClientesRecurrentes)
WHERE Cruce3 =
EXCEPT(UNION(Crossing,Cruce1,Cruce2),ClientesRecurrentes)
RETURN
COUNTROWS(DISTINCT(Cruce3))
I hope and can help me. Best regards!

1 Reply