Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Syndicate_Admin
Administrator
Administrator

¿Cómo obtener el importe de las ventas de este mes?

Hola a todos

Tengo abajo expresión trabajando bien :-

Este año: CALCULATE(sum('order'[Price]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year])))
Esta semana: CALCULATE(sum('order'[Price]), FILTER(ALL('Date'),'Date'[Week Rank]-max('Date'[Week Rank])))
¿Puede alguien compartir conmigo Este mes y la expresión del mes pasado?
Paul
1 ACCEPTED SOLUTION

Hola @Paulyeo11 ,

Basado en la picuture, el resultado deseado de este mes debe ser 40 y el resultado del mes pasado está en blanco si lo conseguí correctamente.

Crea una medida como esta:

_this month = 
CALCULATE (
    SUM ( 'order'[Price] ),
    FILTER (
        ALL ( 'Date' ),
        MONTH ( 'Date'[Date] )
            = MONTH (
                CALCULATE (
                    MAX ( 'SI_PM_'[AR Invoice Date] ),
                    ALLEXCEPT ( SI_PM_, SI_PM_[SOURCE] )
                )
            )
    )
)

_previous month = 
CALCULATE (
    SUM ( 'order'[Price] ),
    FILTER (
        ALL ( 'Date' ),
        MONTH ( 'Date'[Date] )
            = MONTH (
                CALCULATE (
                    MAX ( 'SI_PM_'[AR Invoice Date] ),
                    ALLEXCEPT ( SI_PM_, SI_PM_[SOURCE] )
                )
            ) - 1
    )
)

month value.png

Compruebe el archivo modificado en el siguiente, espera ayudarle. Si no ayuda, por favor no dude en hacerme saber.

Best Looks,
Yingjie Li

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Paulyeo11 , por mes, crear un rango en la fecha de inicio del mes

Nueva columna en la tabla de fechas

Rango del mes : RANKX(all('Date'),'Date'[Month Start date],ASC,Dense)

Medida
Este mes: CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]-max('Date'[Month Rank])))
Last Month ( CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]-max('Date'[Month Rank])-1))

para Qtr

Rango de Qtr á RANKX(all('Date'),'Date'[Fecha de inicio de Qtr],ASC,Dense)
Este Qtr - CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]-max('Date'[Qtr Rank])))
Last Qtr á CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]-max('Date'[Qtr Rank])-1))

hacer referencia a cómo crear estas fechas de inicio en mi serie de videos calender o este blog

My Video Series ,

1.Crear calendario financiero - Desde cualquier mes
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calend...

Power BI — Año tras año con o sin inteligencia de tiempo
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
Power BI — Qtr en Qtr con o sin inteligencia de tiempo
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
Power BI — Mes a mes con o sin inteligencia de tiempo
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
Power BI — Semana a semana y WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
Inteligencia del día - Último día, último día no continuo
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5c3243d...

Hola Amit

Gracias por su ayuda.

Mis datos sin procesar tienen datos del mes actual :-

Paulyeo11_0-1602664926712.png

Cuando utilizo su expresión , sin error , pero devuelve el valor nulo :-

Paulyeo11_1-1602664972201.png

Mi archivo PBI :-

https://www.dropbox.com/s/b939tr67qc3g8qu/preWebinarPostCal_PY_DATA%20V003.pbix?dl=0

Espero que pueda hacerme saber dónde ir mal ?

Paul

Hola @Paulyeo11 ,

Basado en la picuture, el resultado deseado de este mes debe ser 40 y el resultado del mes pasado está en blanco si lo conseguí correctamente.

Crea una medida como esta:

_this month = 
CALCULATE (
    SUM ( 'order'[Price] ),
    FILTER (
        ALL ( 'Date' ),
        MONTH ( 'Date'[Date] )
            = MONTH (
                CALCULATE (
                    MAX ( 'SI_PM_'[AR Invoice Date] ),
                    ALLEXCEPT ( SI_PM_, SI_PM_[SOURCE] )
                )
            )
    )
)

_previous month = 
CALCULATE (
    SUM ( 'order'[Price] ),
    FILTER (
        ALL ( 'Date' ),
        MONTH ( 'Date'[Date] )
            = MONTH (
                CALCULATE (
                    MAX ( 'SI_PM_'[AR Invoice Date] ),
                    ALLEXCEPT ( SI_PM_, SI_PM_[SOURCE] )
                )
            ) - 1
    )
)

month value.png

Compruebe el archivo modificado en el siguiente, espera ayudarle. Si no ayuda, por favor no dude en hacerme saber.

Best Looks,
Yingjie Li

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

Paulyeo11
Impactful Individual
Impactful Individual

Hola Ying

muchas gracias por su efecto.

Paul

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors