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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AnetaK
Helper V
Helper V

Running Total (based on projects)

Hello,

I need help in creating a Running Total measure, but what is important - it should be based on projects, not dates.
Usually, Running Total is created by date, we start in January and increase e.g. the sum of sales with each month.

Now I have to create this sum, but based on the size of the project (% share of costs in the total).
First we take the largest project, then add a smaller and smaller one to it...
The table has to show the 10 largest projects.

The table is also to be filtered by various filters, such as the date, so the project position cannot be set hard.
If, for example, each project was permanently assigned a rank (in PQ or a calculated column in DAX), then the filter will not work on this rank.
The largest project in January may already be finalized in February and may not appear in the data from February at all.
Therefore, everything has to be dynamic.

Below is a table showing how it should look like.
Anyone have any idea how to come to this?

(P.S. Cost and Cost% are DAX measures).

 

AnetaK_0-1612261573865.png

 

 

1 ACCEPTED SOLUTION
AnetaK
Helper V
Helper V

I've found a sulution (article i Polish).

It was so simple... <facepalm>

 

Cumulative Total =
VAR total_sales = [Total Sales]
RETURN
    IF (
        NOT ( ISBLANK ( total_sales ) ),
        CALCULATE (
            [Total Sales],
            FILTER ( ALLSELECTED ( Sales[Product] )total_sales <= [Total Sales] )
        )
    )

 

https://cwiok.pl/index.php/pl/2019/06/02/skumulowana-suma-po-produktach-w-daxie/

View solution in original post

5 REPLIES 5
AnetaK
Helper V
Helper V

I've found a sulution (article i Polish).

It was so simple... <facepalm>

 

Cumulative Total =
VAR total_sales = [Total Sales]
RETURN
    IF (
        NOT ( ISBLANK ( total_sales ) ),
        CALCULATE (
            [Total Sales],
            FILTER ( ALLSELECTED ( Sales[Product] )total_sales <= [Total Sales] )
        )
    )

 

https://cwiok.pl/index.php/pl/2019/06/02/skumulowana-suma-po-produktach-w-daxie/

@AnetaK , Thanks for posting the solution. Kudos to you.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
AnetaK
Helper V
Helper V

@amitchandak What do you mean by "Table[project] <= max(Table[project]" ?

Table[project] is a name of the project and it's dummy data.

 

@AnetaK , I was trying to build cumulative based on displayed data.

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
amitchandak
Super User
Super User

@AnetaK , create a measure like

 

divide(calculate( sum(Table[cost]), filter(allselected(Table), Table[project] <= max(Table[project]))) ,calculate( sum(Table[cost]), allselected(Table)))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.