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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
PowerBI87
Frequent Visitor

Columna para calcular el año

Hola

¿Puedo obtener ayuda para escribir una función que generará la columna a la derecha?

EmpresaProductoañoSalida
ABC CorpA2017Primer año
GHY CorpA2018Primer año
YYZ CorpB2020Segundo año
ABC CorpA2018Segundo año
ABC CorpA2019Tercer año
YYZ CorpB2019Año de los abetos
HYU CorpA2020Primer año
3 REPLIES 3
az38
Community Champion
Community Champion

Hola @PowerBI87

tratar de crear una columna

Output = 
var r = RANKX(FILTER(ALL('Table'), 'Table'[Company] = EARLIER('Table'[Company]) && 'Table'[Product] = EARLIER('Table'[Product])),
'Table'[Year], , ASC)
var textRank = SWITCH(r,
1, "First",
2, "Second",
3, "Third",
BLANK())
RETURN
textRank & " Year"Q

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
collinq
Super User
Super User

Hola @PowerBI87 ,

Para ayudar, tendría que entender cómo se está determinando la salida. Obviamente no es el Año - Salida así que ¿cuáles son las variables que está tratando de utilizar?

Agradecería Kudos si mi respuesta fue útil. También agradecería que marcara esto como una solución si resolviera el problema. ¡Gracias!



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

Proud to be a Datanaut!
Private message me for consulting or training needs.




parry2k
Super User
Super User

@PowerBI87 agregar una columna con la siguiente expresión

Output = 
VAR __minYear = CALCULATE ( MIN ( Table[Year] ), ALLEXCEPT ( Table, Table[Company] ) ) 
RETURN Table[Year] - __minYear ) + 1

Me gustaría elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!

Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionados con Power BI.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors