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
abukapsoun
Post Patron
Post Patron

Soporte de cálculo

Hola Caballeros,

Necesita su apoyo con lo siguiente:

Tengo esta mesa

TipoP01P..P12
CountryXVentasCafé
CountryXMargen de ventasCafé
CountryXVentas
CountryXMargen de ventas

Quiero hacer lo siguiente:

Calcular ventas de Q1 : P01+P02+P03

Calcular el margen de ventas de Q1: P01+P02+P03

.

mismo hasta el cuarto trimestre

Pensé en Despivotting P01-P12 pero entonces qué?

Quiero tener un gráfico apilado donde puedo mostrar 2 barras, una para ventas y otra para el margen de ventas uno al lado del otro, mientras que el eje X es el trimestre.

Y luego cree otra columna apilada para mostrar el margen de ventas y ventas mientras que el eje X es el Tipo

Gracias

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Hola, @abukapsoun , ¿qué tal calcular el número de trimestres después de despivor P01-P12. A continuación, los datos de ventas se tranforman en una tabla unidimensional. Se adjunta un archivo pbix para su referencia.

Screenshot 2020-09-13 195934.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@abukapsoun , Primero de despivor la tabla. A continuación, crear tabla de período con Period y Qtr , si tiene el año, puede agregarlo. O crear una tabla de períodos de año. Cree el rango de período si es necesario qtr rank .

nueva columna en la tabla de períodos

Qtr - Interruptor (true(),

[período] en "P01","P02","P03", "1",

[período] en "P04","P05","P06", "2"

seguir añadiendo

}

Aquí La fecha es su tabla de períodos

Rango del mes : RANKX(all('Date'),'Date'[Period],ASC,Dense) // period or year -period
Este mes: CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]-max('Date'[Month Rank])))
Last Month ( CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]-max('Date'[Month Rank])-1))
Last year MonthTM CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]-(max('Date'[Month Rank]) -12)))

Qtr o Qtr Rank

Qtr Rank á RANKX(all('Date'),'Date'[Qtr],ASC,Dense) //on Qtr or Year - Qtr
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))

CNENFRNL
Community Champion
Community Champion

Hola, @abukapsoun , ¿qué tal calcular el número de trimestres después de despivor P01-P12. A continuación, los datos de ventas se tranforman en una tabla unidimensional. Se adjunta un archivo pbix para su referencia.

Screenshot 2020-09-13 195934.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.