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
Syndicate_Admin
Administrator
Administrator

Los totales no se muestran correctamente en una tabla

Hola a todos,

Estoy seguro de que existe una solución simple a mi consulta, ¡pero parece que no puedo resolverla en este momento!

Tengo una tabla que contiene datos financieros llamada all_relevant_transactions. En esta tabla tengo varios campos calculados que calculan varios totales. A continuación se muestra un ejemplo:

Total_Rec_201112_Gross =
CALCULAR(
SUM (all_relevant_transactions[destcodetotal]),
(todos_relevant_transactions[stAtusCodeName]="Paid"),
FECHASBETWEEN(
all_relevant_transactions[si_transactiondateofpayment],FECHA(2011,9,01),DENE(2012,8,31)))

The Campos calculados themselves are working fine in principle, but I have a problem when showing the Totales in a table. The all_relevant_transactions table contains TODO financial transactions for TODO contacts, and it has a relationship to a Contacto table via an N:N relationship that only contains a few of the contacts that exist in the all_relevant_transactions table. So, the all_relevant_transactions table may contain financial transactions for 1000 contacts, but the Contacto table may only have 12 contacts in it (this is because it has been filtered down).

So, when I show this data in a table and select the Totales option, it is giving me a total for TODO financial transactions relating to the relevant Campo calculado from the all_relevant_transactions table. The example below shows you what I mean:

jonclay_0-1670493840083.png


Lo que realmente necesito es el total de cada columna para mostrar el total de todas las filas y no el total general relacionado con el campo calculado. Sospecho que esto tiene algo que ver con la forma en que he creado los campos calculados , ¡pero no puedo averiguar qué he hecho mal!

Cualquier ayuda sería muy apreciada.

Muchas gracias
Jon

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

@jonclay ,

Los totales que no se muestran correctamente son algo muy común en Power BI. Tal vez debería conocer la función ISINSCOPE y la función ALL o ALLEXPECT.

Función ISINSCOPE (DAX) - DAX | Microsoft Learn

Función ALL (DAX) - DAX | Microsoft Learn

Función ALLEXCEPT (DAX) - DAX | Microsoft Learn

Como no puedo ver sus datos, aquí hay una muestra para su referencia.

Puede observar que los totales de las dos columnas calculadas no son los mismos.

vyadongfmsft_0-1670550997352.png

La fórmula DAX de las dos columnas calculadas:

% = 
IF (
    ISINSCOPE ( 'Table'[School] ),
    DIVIDE ( [Count], [Total count 2] ),
    DIVIDE ( [Total count 2], CALCULATE ( [Count], ALL ( 'Table' ) ) )
)

% 2 = DIVIDE ( [Count], [Total count 2] )

Saludos

Yadong Fang

Si esta publicación ayuda, considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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