Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Thiagops
Helper II
Helper II

Ambiguity when relating tables

Good morning,

I need to know how many customers a seller registered in the month.

I have the following tables:

- Calendar (Related to outgoing invoice)

- Sellers (related to customers)

- Customers (Related to outgoing invoice)

- Exit invoice

 

I'm using data tracking to choose the seller and the month, but I believe that because the customer table is not directly related to the calendar, it doesn't work. The result is not correct. I tried to relate the calendars table with the customers, but it says that it generates ambiguity with the outgoing invoice.

 

I'm using the following measure: 

New customer registration = DISTINCTCOUNTNOBLANK('CUSTOMER (WALLET)'[CLI_CODIGO])

1 ACCEPTED SOLUTION

@Thiagops 

You are right. Please try

Cadastro de NOVOS clientes2 =
CALCULATE (
    DISTINCTCOUNTNOBLANK ( 'CLIENTE (CARTEIRA)'[CLI_CODIGO] ),
    'CLIENTE (CARTEIRA)'[Registration Date] IN VALUES ( CALENDARIO[Date] )
)

View solution in original post

12 REPLIES 12
tamerj1
Super User
Super User

Hi @Thiagops 

please provide screenshots of your data model (model view) and the visual that shows the wrong results 

 

Só funciona a seguimentação de dados para o vendedor.

A seguimentação de dados para ano e mes não funciona.

Thiagops_0-1676643856133.png

 

Thiagops_1-1676644096411.png

 

@Thiagops 
Please try

New customer registration =
CALCULATE (
    DISTINCTCOUNTNOBLANK ( 'CUSTOMER (WALLET)'[CLI_CODIGO] ),
    CROSSFILTER ( 'Calendar'[Date], 'Exit invoice'[Date], BOTH )
)

Still the same result

I also tried with USERELATIONSHIP, but it didn't work

@Thiagops 

Apologies, that was a mistake. Please try

New customer registration =
CALCULATE (
DISTINCTCOUNTNOBLANK ( 'CUSTOMER (WALLET)'[CLI_CODIGO] ),
CROSSFILTER ( Customer[Customer Key], 'Exit invoice'[Customer Key], BOTH )
)

The result has changed as the data slices change, but still the values ​​are wrong.
The tables CLIENTE (CARTEIRA) and NF_SAIDA (CARTEIRA) are related by column CLI_CODIGO does it interfere?
The code I used now was:


Cadastro de NOVOS clientes2 =
CALCULATE(
DISTINCTCOUNTNOBLANK('CLIENTE (CARTEIRA)'[CLI_CODIGO]),
CROSSFILTER('CLIENTE (CARTEIRA)'[CLI_CODIGO],'NF_SAIDA (CARTEIRA)'[CLI_CODIGO],Both))

@Thiagops 

How did you judge that the results are wrong? However, you can simply return the same result as

Cadastro de NOVOS clientes2 =
DISTINCTCOUNTNOBLANK('NF_SAIDA (CARTEIRA)'[CLI_CODIGO])

I counted directly in the table and the result should be 10 (If you filter seller X in December 2022, he registered only 10 customers). The formulas mentioned above are returning the number of customers he sold (In the case of December, it returns 31).

From what I understand this happens because the CALENDARIO table is filtered by the NF_SAIDA (WALLET) table. If we can find some way to relate the CALENDAR with the CLIENT (WALLET) directly, I think that solves it.

 

@Thiagops 

You are right. Please try

Cadastro de NOVOS clientes2 =
CALCULATE (
    DISTINCTCOUNTNOBLANK ( 'CLIENTE (CARTEIRA)'[CLI_CODIGO] ),
    'CLIENTE (CARTEIRA)'[Registration Date] IN VALUES ( CALENDARIO[Date] )
)

@tamerj1  thank you very much.
It was right. GOD reward you, you helped me a lot.

Does this that was done force a relationship?

@Thiagops 

No that was just a filter that simulates a relationship 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.