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
danielmillion
Frequent Visitor

Cálculo a partir de la consulta Imported & Direct

Hola

Tengo una aplicación powerapps que permite la entrada de datos. Esta aplicación está conectada a SQL Server y actualiza los datos allí.

Uso la consulta directa para recuperar datos de ese SQL Server sql Server como quiero los datos más recientes en todo momento.

Tengo una tabla importada de la base de datos de nuestro cliente (son los datos de mayor).

Lo que im tratando de hacer es sumar los datos de mayor con la entrada del usuario, para presentar la cantidad total de valor de g /L y la entrada del usuario.

Funciona bien cuando uso una sola medida:

Valor total ?

calcular el valor en el g/L

CALCULATE(SUM('Tabla de mayor importada'[Valor]))+

calcular el valor por mes a partir de la tabla de entrada estructurada dinámica

IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-1,CALCULATE(SUM('Input Table'[jan])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-2,CALCULATE(SUM('Input Table'[feb])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-3,CALCULATE(SUM('Input Table'[mar])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-4,CALCULATE(SUM('Input Table'[apr])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-5,CALCULATE(SUM('Input Table'[may])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-6,CALCULATE(SUM('Input Table'[jun])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-7,CALCULATE(SUM('Input Table'[jul])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-8,CALCULATE(SUM('Input Table'[aug])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-9,CALCULATE(SUM('Input Table'[sep])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-10,CALCULATE(SUM('Input Table'[oct])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-11,CALCULATE(SUM('Input Table'[nov])),
IF(MONTH(SELECTEDVALUE('Dates Table'[DateMonth]))-12,CALCULATE(SUM('Input Table'[dec])),

si no se selecciona la fecha, recupere la suma de todos los meses para calcular el total de

CALCULATE(SUM('Input Table'[jan]))+
CALCULATE(SUM('Tabla de entrada'[feb]))+
CALCULATE(SUM('Input Table'[mar]))+
CALCULATE(SUM('Tabla de entrada'[apr]))+
CALCULATE(SUM('Tabla de entrada'[puede]))+
CALCULATE(SUM('Input Table'[jun]))+
CALCULATE(SUM('Tabla de entrada'[jul]))+
CALCULATE(SUM('Input Table'[aug]))+
CALCULATE(SUM('Input Table'[sep]))+
CALCULATE(SUM('Input Table'[oct]))+
CALCULATE(SUM('Tabla de entrada'[nov]))+
CALCULATE(SUM('Input Table'[dec]))

))))))))))))

El problema con esta medida es que es PAINFULLY SLOW. Un minuto completo para profundizar en un gráfico de tabla o barra.
También intenté usar UNION y SELECTCOLUMNS para combinarlos en una tabla calculada, y luego simplemente devuelvo la SUMA de una columna,
que es muy rápido, PERO, no devolverá los datos de entrada de esta manera al hacer clic en actualizar en la actualización del servicio power bi o actualización de la página de cromo.


Estimado complejo, ¿hay alguna sugerencia, algo que hice mal, o cualquier guía que me pueda dar?
¡Muchas gracias!
2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@danielmillion ,

Puede modificar el patrón dax como a continuación:

Total Value =
SUM ( 'Imported G/L Table'[Value] )
    + SWITCH (
        MONTH ( SELECTEDVALUE ( 'Dates Table'[DateMonth] ) ),
        1, SUM ( 'Input Table'[jan] )
    )

Equipo de Apoyo Comunitario _ Jimmy Tao

Si este post ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

parry2k
Super User
Super User

@danielmillion Sus tablas de datos necesitan ser sin pivotar, es extraño que de los datos de back-end se está mostrando como pivotado, que esta cómo se almacenan los datos? si obtiene datos sin pivotar y mes y valor en las filas y luego será súper rápido y también seguir las mejores prácticas.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.