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
Anonymous
Not applicable

Las ventas del mes anterior por cliente/producto no funcionan a nivel granular

HarshaTNH_0-1597384547906.png

Puse la siguiente fórmula

Entradas anteriores de la montonación de la unión de los Meses de la
VAR CurrentMonth - SELECTEDVALUE('Resumen de cuenta de TPAMS Combinado'[CalendarMonth])
VAR CurrentYear ? SELECTEDVALUE('Resumen de cuenta de TPAMS Combinado'[CalendarYear])
devolución

IF(HASONEVALUE('Resumen de la cuenta de TPAMS Combinado'[CalendarMonth]),
SUMX(
FILTRO(
ALL('Resumen de la cuenta de TPAMS combinado'),
IF(CurrentMonth-1,
'Resumen de la cuenta de TPAMS Combinado'[CalendarMonth]-12 &&
'Resumen de la cuenta de TPAMS Combinado'[CalendarYear]-CurrentYear-1,
'Resumen de la cuenta de TPAMS Combinado'[CalendarMonth]-CurrentMonth-1 &&
'Resumen de la cuenta de TPAMS Combinado'[CalendarYear]-CurrentYear
)
),
[SumSales]
)
)
Esto funciona a nivel de mes, pero si pongo más filtros, obtengo valor repetido para el mes
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@HarshaTNH Puede encontrar esto útil - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

También, ver si mi Inteligencia del Tiempo el Camino Duro proporciona una manera diferente de lograr lo que está buscando.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

No es realmente suficiente información para seguir adelante, por favor primero compruebe si su problema es un problema común enumerado aquí: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Además, consulte este post sobre cómo obtener respuesta a su pregunta rápidamente: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

Las partes más importantes son:
1. Datos de muestra como texto, utilice la herramienta de tabla en la barra de edición
2. Salida esperada de los datos de muestra
3. Explicación en palabras de cómo obtener de 1. a 2.


@ 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
v-alq-msft
Community Support
Community Support

Hola, @HarshaTNH

Según su descripción, creé datos para reproducir su escenario. Los archivos pbix se adjuntan al final.

Mesa:

a1.png

Puede crear medidas como se indica a continuación.

Previous Month Customer = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Customer],
    "Result1",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Customer]=EARLIER('Table'[Customer])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())-1
        )
    )
)
return
SUMX(
    tab,
    [Result1]
)

Current Month Customer = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Customer],
    "Result2",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Customer]=EARLIER('Table'[Customer])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())
        )
    )
)
return
SUMX(
    tab,
    [Result2]
)

Difference Customer = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Customer],
    "Result1",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Customer]=EARLIER('Table'[Customer])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())-1
        )
    ),
    "Result2",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Customer]=EARLIER('Table'[Customer])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())
        )
    )
)
return
SUMX(
    tab,
    [Result2]-[Result1]
)

%Change Customer = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Customer],
    "Result1",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Customer]=EARLIER('Table'[Customer])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())-1
        )
    ),
    "Result2",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Customer]=EARLIER('Table'[Customer])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())
        )
    )
)
return
SUMX(
    tab,
    DIVIDE(
           [Result2]-[Result1],
           [Result1]
    )
)

Previous Month Product = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Product],
    "Result1",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Product]=EARLIER('Table'[Product])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())-1
        )
    )
)
return
SUMX(
    tab,
    [Result1]
)

Current Month Product = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Product],
    "Result2",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Product]=EARLIER('Table'[Product])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())
        )
    )
)
return
SUMX(
    tab,
    [Result2]
)

Difference Product = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Product],
    "Result1",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Product]=EARLIER('Table'[Product])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())-1
        )
    ),
    "Result2",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Product]=EARLIER('Table'[Product])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())
        )
    )
)
return
SUMX(
    tab,
    [Result2]-[Result1]
)

%Change Product = 
var tab =  
SUMMARIZE(
    'Table',
    'Table'[Product],
    "Result1",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Product]=EARLIER('Table'[Product])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())-1
        )
    ),
    "Result2",
    CALCULATE(
        SUM('Table'[Sales Value]),
        FILTER(
            ALL('Table'),
            'Table'[Product]=EARLIER('Table'[Product])&&
            MONTH('Table'[Sale Date])=MONTH(TODAY())
        )
    )
)
return
SUMX(
    tab,
    DIVIDE(
           [Result2]-[Result1],
           [Result1]
    )
)

Resultado:

a2.png

Saludos

Allan

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

amitchandak
Super User
Super User

@HarshaTNH, mejor cronor mucho tiempo de inteligencia con tabla de fechas.

Ejemplos

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Next month value =  CALCULATE(sum('table'[total hours value]),nextmonth('Date'[Date]))
	


diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales])

Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
Power BI — QTD
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
Power BI — MTD
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e

En caso de que no tenga una fecha, pruebe el mismo enfoque que una semana, creando rango en el mes año

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únase a ella con la columna de fecha de su/s hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Apreciamos tus Felicitaciones.

Greg_Deckler
Super User
Super User

@HarshaTNH Puede encontrar esto útil - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

También, ver si mi Inteligencia del Tiempo el Camino Duro proporciona una manera diferente de lograr lo que está buscando.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

No es realmente suficiente información para seguir adelante, por favor primero compruebe si su problema es un problema común enumerado aquí: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Además, consulte este post sobre cómo obtener respuesta a su pregunta rápidamente: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

Las partes más importantes son:
1. Datos de muestra como texto, utilice la herramienta de tabla en la barra de edición
2. Salida esperada de los datos de muestra
3. Explicación en palabras de cómo obtener de 1. a 2.


@ 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
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.