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

Suma Acumulada de Venta ( Mayor a Menor de Acuerdo a la Venta )

Hola Tengo una consulta sobre la Suma Acumulada, hay medida Rápidas que acumulan en Base a Fecha u orden alfabético. Tengo una Tabla con Proveedores y Ventas, lo que busco es una DAX que  acumule las Ventas tomando como criterio el que tiene Mayor Venta de Mayor a Menor.

ProveedorVenta
A150
B200
C50
D300

 

Lo que necesito es Ordenar por Venta y que se acumule en Base a la Mayor Venta el Resultado deberia ser:

ProveedorVentaAcumulado<=funcion DAX
D300300 
B200500 
A150650 
C50700 
TOTAL700700 

 

Tienen Alguna idea?

Es decir mi criterio de Ordenación no es la Fecha sino -El que tiene más Venta-.

 

Agradezco su ayuda.

 

Saludos

 

William

 

2 ACCEPTED SOLUTIONS
v-luwang-msft
Community Support
Community Support

Hi @jpaz ,

you could try the following steps:

Step 1, use rankx to sort base data,create a column use the following dax:

RANK = RANKX(ALL('Table'),'Table'[Venta],,desc)
1111.png
 
Step 2,use the following measure to  calculate sum:
final = CALCULATE(SUM('Table'[Venta]),FILTER(ALL('Table'),'Table'[RANK]<=MAX('Table'[RANK])))
 22222.png
Wish it is helpful for you!
 
Best Regards
Lucien 
 

View solution in original post

Hi  @jpaz ,

Use the following dax,You can sort by month group and group for summary:

rank=RANKX(FILTER('Table','Table'[month]=EARLIER('Table'[month])),'Table'[Venta],,desc,Dense)

 

Wish it is helpful for you!

Best Regards

Lucien

 

View solution in original post

5 REPLIES 5
v-luwang-msft
Community Support
Community Support

Hi @jpaz ,

you could try the following steps:

Step 1, use rankx to sort base data,create a column use the following dax:

RANK = RANKX(ALL('Table'),'Table'[Venta],,desc)
1111.png
 
Step 2,use the following measure to  calculate sum:
final = CALCULATE(SUM('Table'[Venta]),FILTER(ALL('Table'),'Table'[RANK]<=MAX('Table'[RANK])))
 22222.png
Wish it is helpful for you!
 
Best Regards
Lucien 
 

Thanks Lucien!
This is fine when there is little data, but I have a 5 year history and would like to be able to filter by year-month to see the accumulated by provider in each case. What could I do?

Hi  @jpaz ,

Use the following dax,You can sort by month group and group for summary:

rank=RANKX(FILTER('Table','Table'[month]=EARLIER('Table'[month])),'Table'[Venta],,desc,Dense)

 

Wish it is helpful for you!

Best Regards

Lucien

 

amitchandak
Super User
Super User

@jpaz , Venta is column

 

calculate(sumx(filter(values(Table[Proveedor]), table[Venta] <=max(Table[Venta])),Table[Venta]), allselected(Table))

 

if Venta is a measure

calculate(sumx(filter(values(Table[Proveedor]), [Venta] <=maxX(Table,[Venta])),[Venta]), allselected(Table))

Hi, thanks for your answer

Gracias por tu respuesta

 

I did a test with the proposed solution, But the result is that the total sum is repeated in each Row.

 

This is my measure: 

Acum = calculate(sumx(filter(values(Tabla[Proveedor]), [Venta_1] <=maxX(Tabla,[Venta_1])),[Venta_1]), allselected(Tabla))
And this is the result
 
Proveedor     Venta_1     Acum
FAMCTEX       11,405       77,020
CRUZ H            7,534      77,020
AGUILAR          6,076      77,020
HUA HOK         5,223     77,020
SUMAR BINDA  4,519   77,020
MARIN PEREZ   3,090   77,020
. . .
. . .
. . .
. . .
TOTAL           77,020     77,020

 

What I can do?

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.