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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ceciliatc
New Member

contar en una columna y traer el resultado a otra

Hola 

 

Tengo dos tablas, la tabla 1 contiene la lista de las facturas con su total y la tabla 2 tiene la lista de las facturas con el nombre de los vendedores implicados en cada venta, lo que necesito es crear una columna en la tabla 1 donde por medio de una formula cuente el numero de personas (de la tabla 2) que estuvieron involucradas en la factura, aqui muestro el ejmplo

 

ceciliatc_0-1714439661411.png

 

1 ACCEPTED SOLUTION

Hi,@ceciliatc 

Regarding the issue you raised, my solution is as follows:

1.In my understanding, what you want now is to use a calculated column instead of a measure, so I have improved my code as follows:

 

New Column = SUMX(
    RELATEDTABLE(Table2),
    IF(Table2[Inv No] = EARLIER(Table1[Inv No]), Table2[Count], 0)
)

 

2.Here's my final result, which I hope meets your requirements.

vlinyulumsft_0-1714700149872.png

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
ceciliatc
New Member

Hola, ya intente y como medida funciona, sin embargo lo que yo necesito es traer ese calculo a una columna nueva en mi tabla 1

Hi,@ceciliatc 

Regarding the issue you raised, my solution is as follows:

1.In my understanding, what you want now is to use a calculated column instead of a measure, so I have improved my code as follows:

 

New Column = SUMX(
    RELATEDTABLE(Table2),
    IF(Table2[Inv No] = EARLIER(Table1[Inv No]), Table2[Count], 0)
)

 

2.Here's my final result, which I hope meets your requirements.

vlinyulumsft_0-1714700149872.png

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-linyulu-msft
Community Support
Community Support

Hi,@ceciliatc 

First of all, in my understanding, your requirement is to count the sum of the columns you represent in Table 2 in the case of the same inv no, and then return to Table 1 as the new column. If my understanding is wrong, please give me your relative opinion:

Regarding the issue you raised, my solution is as follows:

1.First I have created the following tables and the column names and data are the data you have given:

Table1:

vlinyulumsft_0-1714447208676.png

Table2:

vlinyulumsft_1-1714447224314.png

2. Then I created the following measure to achieve grouping, statistical, by inv no as the main filter criteria:

Nueva Columna = CALCULATE(SUM(Table2[Count]),FILTER(ALLSELECTED(Table1),'Table1'[Inv No]=MAX('Table2'[Inv No])))

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_2-1714447325940.png

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.