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
gomezc73
Helper IV
Helper IV

Variación en su lugar total en Matrix

Hola Expertos,

¿Podría ayudarme con este tema?

Tengo una tabla con ventas mensuales por año/mes, como esta

código de productoDescripciónañoEneroFebreroMarzoAbrilMayoJunioJulAgostoSeptiembreOctubreNoviembreDiciembre
M01Producto A2019101222321210562360659098
M01Producto A202081516182554246589120100125
M02Producto B201931325211787983454264355
M02Producto B20201532545676545643229018130

Entonces, necesito generar una nueva fila debajo de cada producto con la Variación 2020 menos 2019 para cada mes.

Algo como esto:

desired.JPG

Traté de usar una matriz, pero sólo hacer una suma de los valores para cada mes, Es posible cambiarlo para generar una fila con la variación 2020 menos 2019?..

Variation.JPG

1 ACCEPTED SOLUTION

@gomezc73 - Reúna un ejemplo más concreto para usted con sus datos. La medida rápida básicamente discute el concepto de cómo hacerlo, cómo utilizar HASONEVALUE, ISINSCOPE, etc. para averiguar dónde se encuentra en la jerarquía / matriz y luego puede decidir cómo hacer su cálculo en consecuencia. Consulte PBIX adjunto debajo de sig. Página 6, Cuadro (6), Medida 6.

Measure 6 = 
    VAR __productcode = MAX([product code])
    VAR __description = MAX([description])
    VAR __year = MAX([year])
    VAR __Month = MAX([Attribute])
    VAR __2019 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2019),[Value])
    VAR __2020 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2020),[Value])
RETURN
    IF(ISINSCOPE([year]),SUM([Value]),__2020 - __2019)


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@gomezc73 - Desea MM3TR&R - https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Gracias fot su ayuda, Puede ayudar es muy similar. pero no soy un usuario experto.. ¡¡Lo siento!!. ¿Es muy complicado modificar la fórmula para generar la diferencia en lugar de MIN/Max o AVE?

@gomezc73 - Reúna un ejemplo más concreto para usted con sus datos. La medida rápida básicamente discute el concepto de cómo hacerlo, cómo utilizar HASONEVALUE, ISINSCOPE, etc. para averiguar dónde se encuentra en la jerarquía / matriz y luego puede decidir cómo hacer su cálculo en consecuencia. Consulte PBIX adjunto debajo de sig. Página 6, Cuadro (6), Medida 6.

Measure 6 = 
    VAR __productcode = MAX([product code])
    VAR __description = MAX([description])
    VAR __year = MAX([year])
    VAR __Month = MAX([Attribute])
    VAR __2019 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2019),[Value])
    VAR __2020 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2020),[Value])
RETURN
    IF(ISINSCOPE([year]),SUM([Value]),__2020 - __2019)


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.