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

Comparación de datos en formato de texto entre los valores de este año con el año anterior

Buenos dias a todos.

 

Puede ser algo facil pero en este momento me encuentro aprendiendo acerca de Power BI, no se si me podrian ayudar con la siguiente pregunta, tengo los datos de los colores que se generaban mes a mes del 2021 y 2022, tengo que mostrar en una tabla como la siguiente imagen en la cual yo pueda comparar si el color es el mismo en los dos años o son diferentes.
Se que puedo traer los datos del año anterior con la función DATEADD, pero solo logro que funcione para datos numericos por la función CALCULATE.

No se si me podrian hacer el favor de indicarme como realizarlo.

ejemplo.png

 

Muchas gracias por su tiempo. Cordial saludo

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Using a date table and time intelligence

 

YTD = CALCULATE(Max(Table[Status]),DATESYTD('Date'[Date],"12/31"))
Last YTD = CALCULATE(Max(Table[Status]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

Year behind = CALCULATE(Max(Table[Status]),dateadd('Date'[Date],-1,Year))
Year behind = CALCULATE(Max(Table[Status]),SAMEPERIODLASTYEAR('Date'[Date]))

 

refer if needed

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

View solution in original post

2 REPLIES 2
v-xiaosun-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, I made a sample and here is my solution.

Sample data:

vxiaosunmsft_0-1669016717552.png

Create a calculated column to compare two columns.

Column =
IF (
    SUMX ( 'Table', SEARCH ( 'Table'[2021], 'Table'[2022], 1, 0 ) ) > 0,
    "Yes",
    "No"
)

Final output:

vxiaosunmsft_1-1669016789872.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Using a date table and time intelligence

 

YTD = CALCULATE(Max(Table[Status]),DATESYTD('Date'[Date],"12/31"))
Last YTD = CALCULATE(Max(Table[Status]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

Year behind = CALCULATE(Max(Table[Status]),dateadd('Date'[Date],-1,Year))
Year behind = CALCULATE(Max(Table[Status]),SAMEPERIODLASTYEAR('Date'[Date]))

 

refer if needed

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

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.

Top Solution Authors