Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
4 years ago
Solved

Totales incorrectos - Matriz

¡Buenos días! Creo que tengo una situación bastante compleja y agradecería mucho algo de ayuda. Específicamente, no puedo obtener los totales para identificar correctamente la fila, columna ...
  • Syndicate_Admin's avatar
    4 years ago
    Customer Inflation with Fixed Totals = 
    VAR vTable = 
    ADDCOLUMNS(
        SUMMARIZE('Invoice History',
            'Date'[Fiscal Year Number],
            'Date'[Month],
            'Invoice History'[Site],
            'Invoice History'[Item Number]
        ),
        "@inflation", [Customer Inflation]
    )
    VAR TotalInflation =
        SWITCH(
            TRUE(),
            HASONEVALUE('Date'[Month]) && HASONEVALUE('Invoice History'[Item Number]),
                [Customer Inflation],   // Base data
            HASONEVALUE('Date'[Month]),  
                CALCULATE(
                    SUMX( vTable,
                    [@inflation]
                    )
                ),                                                                      // column totals,
            HASONEVALUE('Invoice History'[Item Number]),                                // row totals
                CALCULATE(
                    SUMX(
                        vTable,
                        [@inflation]
                    ),
                    VALUES('Date'[Month])
                ),                                                                      // grand total
            SUMX(
                vTable,
                [@inflation]
            )
        )
    RETURN
        TotalInflation

    Solución de trabajo