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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
eddd83
Resolver I
Resolver I

Measure for calculating row by row sums based on dates

I need to produce a table similar to this spreadsheet

 

table1.PNG

 

So far, I just have this very empty table of dates based on a seperate "date" table. 

 

table2.PNG

The "date" table in question.

 

table3.PNG

 

 

The crux of my problem: basically, in the "task" table I need to compare the "due date" column to the "task completion date" column, and then do a sum based on the row context in the 2nd picture above. The fact that I have two seperate tables ("date" & "task") only further complicates my problem. 

table4.PNG

 

Help?

1 ACCEPTED SOLUTION

You can do this all in the one Power BI model without exporting/importing.

 

First thing I would do is to create a separate date table. You can do this in multiple ways, but one of the easiest is to create a calculated table using the CALENDAR() function. Then you would use this table (or columns from this table) to do all your date filtering on your report.

 

Then you would create a measure like the following

Overdue Tasks = COUNTROWS(
    filter(tasks
        , Tasks[Due Date] <= MAX('Date'[Date]) 
        && if(ISBLANK(Tasks[Completion Date]),date(2999,12,31),Tasks[Completion Date])>= min('Date'[Date]) 
    )
)

This produces the following output (the output is on the left, my test data is on the right)

201905 overdue tasks.png

View solution in original post

4 REPLIES 4
eddd83
Resolver I
Resolver I

Basically, I want to see how many tasks are overdue as of that date. If the task was due on 1/1/2019 and the task was also completed on 1/1/2019, then it wouldn't count as being overdue.

 

For example, for 1/1/2019, the 1st row with task "Validation of OE Facility Register" has a due date of 1/1/2019 and task completion date of 1/10/2019. Therefore, it would count as 1 towards 1/1/2019

 

Another example, for 1/29/2019, the last row with task "Report Monthly LPS Metrics" has a due date of 1/28/2019 and task completion date of 1/18/2019. Therefore, it would count as 0 towards 1/29/2019.

 

 Count
1/1/20194
1/8/20195
1/15/20198
1/22/20199
1/29/20199

 

 

Inkedmay 9 data table_LI.jpg

 

Just curious if this can be entirely done in power bi. I can envision a different scenario where you export the data table (2nd picture) into a spreadsheet with array formulas. Then output that same spreadsheet with calculated values back into power bi. 

You can do this all in the one Power BI model without exporting/importing.

 

First thing I would do is to create a separate date table. You can do this in multiple ways, but one of the easiest is to create a calculated table using the CALENDAR() function. Then you would use this table (or columns from this table) to do all your date filtering on your report.

 

Then you would create a measure like the following

Overdue Tasks = COUNTROWS(
    filter(tasks
        , Tasks[Due Date] <= MAX('Date'[Date]) 
        && if(ISBLANK(Tasks[Completion Date]),date(2999,12,31),Tasks[Completion Date])>= min('Date'[Date]) 
    )
)

This produces the following output (the output is on the left, my test data is on the right)

201905 overdue tasks.png

That seems to do the trick, thanks!

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @eddd83 ,

 

What is the desired result? For example, in above second table visual, what is the corrsponding value in the first row for date "February,1, 2018", then for date "February, 8, 2018"? Please illustrate with examples.

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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