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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Gjakova
Post Patron
Post Patron

¿Cómo calcular la puntuación del año pasado sin usar una tabla de fechas?

Hola

Estoy haciendo un informe donde no tengo un calendario de citas. Así que no puedo utilizar funciones de TI como SAMEPERIODLASTYEAR o DATEADD, porque lo único que es relevante en mis datos son las estaciones, por ejemplo, temporada 2002/2003, 2003/2004 ..... 2020/2021

En este escenario, al crear un KPI, ¿cómo puedo crear una medida que cambie dinámicamente en función de los filtros que selecciono? Así que cuando filtro en 2018/2019.

Mi KPI muestra ese año + año anterior (2017/2018). Cuando selecciono 2006/2007, mi KPI muestra ese año + año anterior (2005/2006).

¿Alguien que tenga una idea?

6 REPLIES 6
Anonymous
Not applicable

Hola @Gjakova

Prueba esta medida.

Current+PrevYear = 
VAR selectedYearKey = SELECTEDVALUE(Years[Year_KEY])//Decide how will you handle no selection and mutiple selection
VAR PrevYearKey = selectedYearKey - 1
Return SUMX(
    FILTER(ALL(Scores), Scores[Year_KEY] in {selectedYearKey, PrevYearKey})
    , Scores[Score])

Espero que esto ayude.

Por favor, márquelo como una solución si sirve para el propósito.

Gracias

amitchandak
Super User
Super User

@Gjakova , Prefiere tener una tabla De año separada al menos , Trate de usar el año numérico o el rango para obtener eso.

Con tabla de fecha/año

Este año: CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year])))
Last Year ? CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year])-1))

comprobar la opción de sin usar inteligencia de tiempo

Power BI — Preguntas YTD — Inteligencia de tiempo 1–5
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

@Gjakova solución adjunta

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 relacionadas 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.

Hola @amitchandak,por desgracia no puedo trabajar con tablas de citas. Tampoco trabajo con años completos, sino con temporadas. Así temporada 2017/2018 etc.

Si tiene tiempo, ¿podría probar su método con mis datos de muestra? Lo intenté, pero no puedo hacer que funcione. ¡Esperamos saber de ti!

parry2k
Super User
Super User

@Gjakova si tiene un campo numérico que identifica el orden del año, puede lograrlo utilizando la siguiente medida

Previous Year = 
VAR __id = MAX ( TableYear[Id] ) 
VAR __prevId = __id - 1
RETURN
CALCULATE ( SUM ( Table[Amount] ), TableYear[Id] = __prevId )

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 relacionadas 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.

Intenté tu respuesta, pero en parte funciona @parry2k
Cuando pongo mi medida en una mesa y también los años, que sólo muestra el total anterior, pero los años permanecen en blanco.

¿Podría probarlo con mis datos de muestra y ver si logra hacerlo funcionar? Si funciona, entonces puedo replicar ese mismo truco en mi conjunto de datos real. Muchas gracias de antemano!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors