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
Mekaur
Frequent Visitor

Comparación de valores de meses

Hola

Tengo columna de fecha y medida RAGID. Necesito comparar los valores del último n mes.

Si el usuario selecciona 3 entonces la comparación de los últimos 3 meses debe mostrar,4 entonces duran 4 meses y así sucesivamente.

Ejemplo:

Fecha del producto: RAGID

Pluma Feb 2020 1

Pluma Marzo 2020 0

Pluma Abril 2020 2

Lápiz Feb 2020 0

Lápiz Marzo 2020 2

Lápiz Abril 2020 0

0-Rojo,1-Ámbar,2-Verde

Necesito comparar RAGID durante tres meses, como feb con march y march con April. Además, necesito ver si su rendimiento se está deteriorando (1-0) y luego mejorando (0-2) y (0-0) estable.

¿Cómo puedo comparar los valores de los meses que tienen en una columna?

Por favor, hágamelo saber si necesita más información.

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hola

Vea si mi solución aquí ayuda - Flexionar una tabla dinámica para mostrar los datos durante x meses terminado un determinado mes def...


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-xicai
Community Support
Community Support

Hay @Mekaur,

Puede crear columnas como DAX a continuación.

Diff=

Var _LastDate=  CALCULATE(MAX(Table1[Date]),FILTER(ALLSELECTED(Table1),Table1[Product]=EARLIER(Table1[Product]) && Table1[Date]<EARLIER(Table1[Date])))

Var _LastRAGID= CALCULATE(SUM(Table1[RAGID]),FILTER(ALLSELECTED(Table1),Table1[Product]=EARLIER(Table1[Product]) && Table1[Date]= _LastDate))

Return

IF( _LastRAGID= BLANK(), 0, [RAGID] -_LastRAGID )



Performance = SWITCH(TRUE(), [Diff]=0,"stable", [Diff]>0,"improving",[Diff]<0, "deteriorating")

Saludos

Amy

Equipo de apoyo a la comunidad _ Amy

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

Hola @v-xicai

Gracias por su respuesta.

¿Puedo saber por qué está tomando SUM(fecha) en

_LastRAGID

No puedo entenderlo.

v-xicai
Community Support
Community Support

Hola @Mekaur ,

Perdón por mi error. He corregido la fórmula anterior, y puede intentarlo de nuevo.

Saludos

Amy

Hola @v-xicai

No estoy obteniendo los resultados deseados.

Por favor, eche un vistazo a la pregunta una vez más. He hecho algunos cambios.

Creo que estás muy cerca de la solución.

🙂

saludos

Mekaur

amitchandak
Super User
Super User

@Mekaur , Puede utilizar la tabla de fechas de inteligencia de tiempo. Si tiene sin embargo, únase a ella con la tabla de fechas de lo contrario tratar de crear uno como este

Fecha: "01" & [Año del mes] //Chnage data tye hasta la fecha

Ejemplo

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
MOM = [MTD Sales] -[last MTD Sales]

Para obtener lo mejor de la función de inteligencia de tiempo. Asegúrese de que tiene un calendario de fechas y se ha marcado como la fecha en la vista de modelo. Además, únase a él con la columna de fecha de su 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...


Aprecia tus Felicitaciones.

ryan_mayu
Super User
Super User

@Mekaur

Por favor, compruebe si a continuación es la solución que desea.

compare with LM and NM = 
VAR LM = EDATE('Sheet1'[Date],-1)
VAR NM = EDATE('Sheet1'[Date],1)
VAR LM_RAGID = SUMX(FILTER('Sheet1',Sheet1[Product]=Sheet1[Product]&&Sheet1[Date]=LM),Sheet1[RAGID])
VAR NM_RAGID = IF(SUMX(FILTER('Sheet1',Sheet1[Product]=Sheet1[Product]&&Sheet1[Date]=LM),Sheet1[RAGID])=0,0,SUMX(FILTER('Sheet1',Sheet1[Product]=Sheet1[Product]&&Sheet1[Date]=NM),Sheet1[RAGID]))
VAR LM_RAGIDVSRAGID = if(ISBLANK(LM_RAGID),"-"&Sheet1[RAGID],LM_RAGID&"-"&Sheet1[RAGID])
VAR RAGIDVSNMRAGID = if(ISBLANK(NM_RAGID),Sheet1[RAGID]&"-",Sheet1[RAGID]&"-"&NM_RAGID)
RETURN LM_RAGIDVSRAGID&","&RAGIDVSNMRAGID

screenshot.PNG

Gracias y BR

Ryan





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.