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

Filtrar resultados en X Axis

Hola

Nuevo en PowerBI así que disculpa si esto debe ser obvio.

Si tengo los siguientes datos:

Tabla YQ fiscal

Yqrownum
2020 Q 4 1
2020 Q 3 2
2020 Q 2 3
2020 Q 1 4
2019 Q 4 5
2019 Q 3 6
2019 Q 2 7
2019 Q 1 8

Luego otra mesa

YqRepresentanteImporte neto USD
2020 Q 4John Smith200
2020 Q 3Jane Doe500
2019 Q 4John Smith400

Y tengo una cortadora en el artículo YQ, ¿cómo me aseguraría de que:

Un gráfico de barras apiladas solo muestra x números de elementos en el eje x. Específicamente, quería mostrar un máximo de los últimos 4 trimestres en el pasado si no se filtra nada (tengo varios años de datos, el gráfico se llena, pero no quiero filtrar esta información ya que la gente puede querer revisar los elementos 3 años en el pasado).

Había creado una medida:

QuarterSelectBounds á ((CALCULATE(MIN('AnalysisFiscalYearQuarterSort'[rownum]),ALLSELECTED(AnalysisFiscalYearQuarterSort[rownum]))+3))
y luego otra medida
Importe neto USD QuarterSelectBounded á IF(MIN('AnalysisFiscalYearQuarterSort'[rownum]) <- [QuarterSelectBounds], sum('Bookings'[Net Amount USD]), BLANK())
Esto funciona muy bien, pero sólo si estoy usando rownum en el eje x. Tan pronto como lo intercamlo al valor YQ, el mínimo se aplica en el nivel de línea. He leído mucho y siento que podría necesitar crear algún tipo de mesa desconectada, pero estoy un poco perdido en este punto. ¿Alguna ayuda?
Gracias
1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

Si desea que esto funcione para todos los YQ, entonces necesita usar YQ en ALLSELECTED:

QuarterSelectBounds á ((CALCULATE(MIN('AnalysisFiscalYearQuarterSort'[rownum]),ALLSELECTED(AnalysisFiscalYearQuarterSort[YQ]))+3))

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ydrol , Crear una tabla común qtr year, unir con ambas tablas . Crear un rango de año Qtr en que en el año qtr

nueva columna
Rango de Qtr á RANKX(all('Date'),'Date'[Fecha de inicio de Qtr],ASC,Dense)

Medida
Este Qtr - CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]-max('Date'[Qtr Rank])))
Last Qtr á CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]-max('Date'[Qtr Rank])-1))

last 4 Qtr á CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'), 'Date'[Qtr Rank]>'max('Date'[Qtr Rank])-4 && 'Date'[Qtr Rank]<-max('Date'[Qtr Rank])))

AllisonKennedy
Super User
Super User

Si desea que esto funcione para todos los YQ, entonces necesita usar YQ en ALLSELECTED:

QuarterSelectBounds á ((CALCULATE(MIN('AnalysisFiscalYearQuarterSort'[rownum]),ALLSELECTED(AnalysisFiscalYearQuarterSort[YQ]))+3))

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.