Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hola
Necesito ayuda en este caso, tengo una tabla XVENTES (en consulta directa) bruja contiene una fecha (DateEve) y una columna ValEur. Quiero comparar los resultados del mes anterior y el real, ya he creado la medida de que sumar el ValEur para el mes curent.
ahora necesito tomar la suma de ValEur en un período de tiempo que comienza con un mesure y termina con otro.
A continuación tienes mi sintaxis dax para mi CA month-1, y es apparenlty ignorando mi filtro basado en las dos fechas.
La sintaxis de las dos medidas que devuelven mis límites de fechas están a continuación,
CA Month-1 =
CALCULATE( sum(XVENTES[ValEur]),
DATESBETWEEN(XVENTES[DateEve],
[Date_month_str-1],
[Date_month_end-1]))
//end date (it's another mesure)
Date_month_end-1 =
DATE(YEAR(LASTDATE(XVENTES[DateEve])),
MONTH(LASTDATE(XVENTES[DateEve]))-1,
DAY(LASTDATE(XVENTES[DateEve])))
//starting date (it's another mesure)
Date_month_str-1 =
DATE(YEAR(LASTDATE(XVENTES[DateEve])),
MONTH(LASTDATE(XVENTES[DateEve]))-1,
1)
Mi filtro está siendo ignorado, no sé por qué
¿Qué estoy haciendo mal?
Cualquier ayuda es apreciada. Gracias
saludos.
Solved! Go to Solution.
Hola @paulineCom ,
Debe crear una tabla de calendario no relacionada como una segmentación de datos.
Saludos
Liang
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola @paulineCom ,
Debe crear una tabla de calendario no relacionada como una segmentación de datos.
Saludos
Liang
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Thank you @V-lianl-msft it helped me a lot.
I'm not sure to understand how could it work with this table date unlinked to the sales table.
I've understand the dax function, it is really clear.
@paulineCom , Usted debe salir con la tabla para la inteligencia de todos los tiempos
Usted puede obtener este mes vs el último como estos 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]))
this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value = CALCULATE(sum(''Table''[total hours value]),previousmonth('Date'[Date]))
diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales])
//Without TI
Month Rank = RANKX(all('Date'),'Date'[Month],,ASC,Dense)
This Month = 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))
Last year Month= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=(max('Date'[Month Rank]) -12)))
for exemple the
CALCULATE(SUM(XVENTES[ValEur]),DATESMTD(DimDate[Date]))
doen't return any results.
Maybe it's beacause my dimDate is not created correctly, here is the way I did it :
DimDate = ADDCOLUMNS(
CALENDAR(DATE(YEAR(TODAY())-10,1,1),DATE(YEAR(TODAY())+1,12,31)),
"DateEve", FORMAT([Date], "DD/MM/YYYY"),
"Année", YEAR([Date]),
"NoMois", MONTH([Date]),
"Mois", FORMAT([Date], "MM"),
"NoJour", WEEKDAY([Date]),
"Jour", FORMAT([Date], "DD"),
"Trimestre", FORMAT([Date], "TQ")
)
is there anything else i should to to make it work ?
Hello, thank you for helping me,
i've tried this to calculate my valEur on last month (wich is 01/08/2020 to 01/28/2020)
CA Month-1 = CALCULATE( sum(XVENTES[ValEur]), DATESMTD(ENDOFMONTH(DATEADD(XVENTES[DateEve],-1,MONTH))))
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.