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
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors