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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mottamatheus835
Frequent Visitor

Cruzar tabelas com DAX

Olá,

Estou tentando encontrar uma solução para conectar estas duas tabelas de forma que a os dados de META da tabela dimensão LOJAS seja desmembrada no nível da tabela fato VENDA que está segmentada pelo a nível de vendedor (ou seja venda total vendedor por vendedor daquele período).

A coluna que conecta elas é a Loja.

O desmembramento precisa ser a META da Loja distribuída para cada vendedor. A quantidade de vendedores por loja é flexível, po aumentar ou diminuir ao longo do período e cada loja, geralmente, tem uma quantidade diferente da outra.

O cálculo pode ser feito linha a linha em uma coluna nova ou em uma medida, o que funcionar. A base não é grande então calcular linha a linha não é um problema.

Exemplo: 

Meta Loja 1 = $350.000

Se forem 6 vendedores, precisa ser dividido por 6.  

Então em cada linha seria $58333,33

 

 

 

Imagem 1: Tabela Dimensão Lojas

mottamatheus835_0-1665067325541.png

 

Imagem 2 : Tabela fato de vendas (O nível dos dados é por vendedor, então é um nível abaixo da loja)

mottamatheus835_1-1665067867068.png

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @mottamatheus835 

for the numerator your formula is correct but if you have an active relationship between the two tables you can just use RELATED ( Lojas[Meta] )

For the denominator you can use 

COUNTROWS ( CALCULATETABLE ( ARQVENDA, ALLEXCEPT ( ARQVENDA, ARQVENDA[LOJA] ) ) )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @mottamatheus835 

for the numerator your formula is correct but if you have an active relationship between the two tables you can just use RELATED ( Lojas[Meta] )

For the denominator you can use 

COUNTROWS ( CALCULATETABLE ( ARQVENDA, ALLEXCEPT ( ARQVENDA, ARQVENDA[LOJA] ) ) )

Thanks! @tamerj1 

You really helped me.

Solved my problem and I learned something 😆

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors