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

¿Gráfico de columnas agrupadas de comparación de ingresos de 2 años que es dinámico?

Me gustaría un gráfico de columnas agrupadas que muestre los ingresos del año seleccionado y los del año anterior.

Así, por ejemplo, si elijo FY 20 YTD, muestra los ingresos totales para el ejercicio 20 y el año fiscal 19, si el año fiscal 19, tanto el año fiscal 19 como el año fiscal 18, y si el año fiscal 18, mostrará solo los datos del ejercicio fiscal 18 (ya que no hay más datos comparativos del año anterior)

powerbi.PNG

IF( [Año Seleccionado]-"FY20", CALCULATE(SUM('Data from National'[Ingresos]), FILTER('Datos de Nacionales', 'Datos de Nacional'[Año Fiscal]-"FY20 YTD"- Datos de National'[Año fiscal]-"FY19")),IF( [Año seleccionado]-"FY19", CALCULATE(SUM('Data from National'[Revenue]), FILTER('Data from National', 'Data from National'[Año fiscal]-"FY19" ? Datos de National'[Año fiscal]-"FY18")), CALCULATE(SUM('Data from National'[Revenue]), FILTER('Data from National', 'Data from National'[Ejercicio fiscal]-"FY18"))))

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hola @caleb1208

Crear tablas

date = ADDCOLUMNS( CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]))

add columns
fiscal year = IF([month]>=7,[year]+1,[year])

fiscal month = IF([month]>=7,[month]-6,[month]+6)

FY = "FY"&RIGHT([fiscal year],2)

FY = SUMMARIZE('date',[FY],[fiscal year])

Capture9.JPG

Añadir FY[FY] a una segmentación de datos,

Crear medidas

Measure = SELECTEDVALUE(FY[FY])

Measure 2 =
CALCULATE (
    SUM ( 'Table'[sales] ),
    FILTER (
        'date',
        'date'[fiscal year]
            = SELECTEDVALUE ( FY[fiscal year] )
            || 'date'[fiscal year]
                = SELECTEDVALUE ( FY[fiscal year] ) - 1
    )
)

Capture6.JPGCapture7.JPGCapture8.JPG

Saludos
Maggie
Equipo de apoyo a la comunidad _ Maggie Li
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

amitchandak
Super User
Super User

@caleb1208 ,

Ventas YTD á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))

Last YTD Sales á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

2o Last YTD Sales á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

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))

2o año pasado : CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year])-2))

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


Apreciamos tus Felicitaciones.

parry2k
Super User
Super User

@caleb1208 debe crear un calendario de año fiscal y funciones inteligentes de tiempo del año anterior para obtener los números en lugar de escribir esta medida compleja

aquí hay algunos enlaces para usted:

https://www.youtube.com/watch?v=Whu9FZZorpc

https://www.youtube.com/watch?v=7l1M3iSTx1c

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!



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