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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.