Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello, dear comunity:
I'm here cause need help with doing a cumulative sum of sales wich I calculated it with SUM(), need to be representated on a pivot table in excel or matrix in Power BI with DAX. If I do a sum of sales and bring customername to labels I have this result, and I need a solution to receive the orange column's behavior. the sales must be ordered by "Total sales in period" value.
I got the sample data in this url to practice: Sample Sales Data (kaggle.com)
Sorry for my bad grammar in english, I'm still learning.
Kind regards.
Solved! Go to Solution.
Measure =
CALCULATE (
[Sales],
WINDOW (
1, ABS, 0, REL,
ALL ( 'Table'[Etiquetas de fila] ),
ORDERBY ( [Sales], DESC )
)
)
or
Measure 2 =
VAR CustomerSales =
ADDCOLUMNS (
ALLSELECTED ( 'Table'[Etiquetas de fila] ),
"@Sales", [Sales]
)
VAR Result =
SUMX (
WINDOW (
1, ABS, 0, REL,
CustomerSales,
ORDERBY ( [@Sales], DESC )
),
[@Sales]
)
RETURN
Result
Measure =
CALCULATE (
[Sales],
WINDOW (
1, ABS, 0, REL,
ALL ( 'Table'[Etiquetas de fila] ),
ORDERBY ( [Sales], DESC )
)
)
or
Measure 2 =
VAR CustomerSales =
ADDCOLUMNS (
ALLSELECTED ( 'Table'[Etiquetas de fila] ),
"@Sales", [Sales]
)
VAR Result =
SUMX (
WINDOW (
1, ABS, 0, REL,
CustomerSales,
ORDERBY ( [@Sales], DESC )
),
[@Sales]
)
RETURN
Result
It actually worked!
I didn't knew about WINDOW function I investigated documentation and learned a lot from you.
Thank u very much!
Hi @TRIXTERBINOOB ,
You can achive your required output in many different ways and the following is an example.
First create a ranking of sales by customers.
Then, create a cumulative total in the order of customer sales ranking by value.
I attach an example pbix file below:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |