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
Anonymous
Not applicable

Running total with filter

I need to do a running total calculation for the below 

 

TaskDue DateActual Completion Date
A11/15/20182/4/2018
A22/16/20183/7/2018
A33/20/20181/15/2018
A44/21/20182/16/2018
A55/23/20189/28/2018
A66/24/201810/30/2018
A77/26/201812/1/2018
A88/27/20189/9/2018
A99/28/2018 
A1010/30/2018 
A1112/1/2018 


Conditions :

1)  Task should be included in the Running total if the Actual completion date>"Due .Date" or the Actual completion date is null 

2) For instance, Task A5 has a  due date as 5/23/2018 but task completed on 9/28/2018 , it should be calculated untill the Sep-2018 as a backlog, whereas Task A3 should not be in the Running total 

 

Thanks 

 

6 REPLIES 6
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem solved?

 

If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.


If not, please let me know.

 


Best Regards
Icey

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check if this is what you want:

 

1. Assume that all tasks are assigned on 2018/1/1.

 

2. Create a Calendar table.

Calendar = CALENDAR(DATE(2018,1,1),DATE(2018,12,31))

 

3. Create relationship.

rel.PNG

 

4. Create measures like so:

Measure = 
VAR CurrentDate =
    MAX ( 'Calendar'[Date] )
VAR CurrentDueDate =
    MAX ( 'Table'[Due Date] )
VAR CurrentActualDate =
    IF (
        MAX ( 'Table'[Actual Completion Date] ) = BLANK (),
        TODAY (),
        MAX ( 'Table'[Actual Completion Date] )
    )
VAR DD =
    IF (
        CurrentDueDate <= CurrentActualDate
            && CurrentDate <= CurrentDueDate,
        CurrentDueDate,
        IF (
            CurrentDueDate <= CurrentActualDate
                && CurrentDate >= CurrentDueDate
                && CurrentDate <= CurrentActualDate,
            CurrentActualDate,
            IF (
                CurrentDueDate > CurrentActualDate,
                CurrentActualDate,
                IF ( CurrentActualDate = TODAY (), CurrentDate )
            )
        )
    )
VAR Is1 =
    IF ( DD = CurrentDate, 1, IF ( DD <= MAX ( 'Calendar'[Date] ), 1, 0 ) )
RETURN
    Is1
Running total = 
CALCULATE ( COUNT ( 'Table'[Task] ), ALLSELECTED ( 'Table' ) )
    - CALCULATE (
        SUMX ( 'Calendar', [Measure] ),
        FILTER (
            ALLSELECTED ( 'Calendar' ),
            'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
        )
    )

run.gif

For more details, please check the attached PBIX file.

 

If I understand it wrong, please let me know.

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Show the end result that you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

Greg_Deckler
Super User
Super User

Is there a values column?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Didn't understand that. As in?

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.