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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
MauroBote
Helper I
Helper I

Running total for a dynamic percentage by date and category

Hi friends (and @dustinn)

 

Today I've posted a message asking some help and I had a solution Dynamic percentage by date and category, but now I need to add some aditional feature: a running total for a measure generated.

 

I had the following table:

original tableoriginal table

 

And I had to add a dynamic measure affected by DATE visual filter, so:

 

1) Make a Date table. At Modeling tab, click on New Table and insert the DAX:

Date = CALENDAR(MIN('Table'[Plan Date]),MAX('Table'[Plan Date]))

 

2) At Model on the left side, create a relationship between the 2 tables, Table[Plan Date] = Date[Date]

 

3) Create a measure: 

Measure = DIVIDE(SUM('Table'[Weight]),CALCULATE(SUM('Table'[Weight]),ALLEXCEPT('Table','Table'[Project],'Date'[Date])))
 
And its works perfectly, per example If I select visual filter between 01-01-2019 and 31-12-2019 the results is:
Imagen7.jpg
 
But now I need to add a new column: Measure Running Total (ordered ASC by PLAN DATE and grouped by Project).
 
Example 1. If the visual filter is blank, the table should be (in orange the new column):
Imagen9.jpg
 
Example 2. If the visual filter is between 01-01-2019 and 31-12-2019 the results should be:
Imagen8.jpg
 
Please your help!

 

 

 

 

1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Measure RT = 
DIVIDE (
    CALCULATE (
        SUM ( 'Table'[Weight] ),
        FILTER (
            ALLSELECTED('Table'),
            'Table'[PROJECT] in FILTERS('Table'[PROJECT]) &&
            'Table'[PLAN DATE] <= MIN ( 'Table'[PLAN DATE] ) 
        )
    ),
    CALCULATE (
        SUM ( 'Table'[Weight] ),
        ALLEXCEPT ( 'Table', 'Table'[Project], 'Date'[Date] )
    )
)

And the result shows:

11.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

View solution in original post

1 REPLY 1
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Measure RT = 
DIVIDE (
    CALCULATE (
        SUM ( 'Table'[Weight] ),
        FILTER (
            ALLSELECTED('Table'),
            'Table'[PROJECT] in FILTERS('Table'[PROJECT]) &&
            'Table'[PLAN DATE] <= MIN ( 'Table'[PLAN DATE] ) 
        )
    ),
    CALCULATE (
        SUM ( 'Table'[Weight] ),
        ALLEXCEPT ( 'Table', 'Table'[Project], 'Date'[Date] )
    )
)

And the result shows:

11.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

Helpful resources

Announcements
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.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.