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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bigk
Helper II
Helper II

Calculated measure based on date from related table

Hello folks

 

I’ve run into problems with calculated measures. I have 3 tables with meeting dates, projects and tasks. The relationship is one-to-many in the following path - Meeting dates->Projects->Tasks

bigk_0-1720000406713.png

 

My aim is to make a calculated measure “completed tasks” that would report for the current meeting date the total number of closed tasks since last meeting date. E.g. all tasks that are closed after 2020-07-22 but before 2022-10-25 should be reported to 2022-10-25 meeting date. But i need to use meeting date table instead of dates from projects table because there may be more meeting dates than projects. And tasks can be closed after project dates.

 

The same meeting date table should be used as a filter to filter projects and other related info down the relationship path when i build visuals. For example started projects as of meeting date and related tasks (total, not closed).

 

I’ve run out of ideas how to make a measure. Because of meeting-project relationship and consequently project-task relationship, the closed tasks measure is being filtered too. I’ve tried to use variety of calculations elements like remove filters, allselected, etc. but seems that those are overridden by relationship. And I need that relationship because of reporting needs.

 

I’ve made a calculated column for for each task to identify the meeting date and made an inactive relationship to meetings table. Then used USERELATIONSHIP but it did not work as projects are filtering away tasks.

 

Please help me as i've spend too much time on this. 

Thanks, folks.

 

Meeting dates

Meeting date
2018-10-22
2018-07-24
2020-07-22
2019-04-23

 

Projects

Project IDMeeting date
2019-042019-04-23
2020-062020-07-22
2022-152022-10-25
2023-162024-01-29

 

Tasks

ProjectTaskComletion date
2019-0412020-07-22
2019-0422020-07-22
2020-0612022-10-25
2020-0652024-01-29
2022-1562024-01-29

 

1 ACCEPTED SOLUTION
bigk
Helper II
Helper II

I ended up redesigning my query and tables so this is not valid anymore.

View solution in original post

8 REPLIES 8
bigk
Helper II
Helper II

I ended up redesigning my query and tables so this is not valid anymore.

bigk
Helper II
Helper II

Unfortunately not working but we are closer :). We've got one value. 
You can see that there is only 1 completed task between 19.12.2023 and 29.01.2024.

I've made a slicer to filter completed tasks straight from the tasks table and you can see there are 5 of them. I've unlinked slicer from the left table. Count of projects and tasks seems to be reporting OK as those are hardlinked through relationship but measure is not. And there is also total missing which looks to me wierd.

 

bigk_0-1720007309147.png

 

Hi @bigk - Ok, i was checking on that only, can you try below one.

 

Completed Tasks =
VAR CurrentMeetingDate = SELECTEDVALUE('Meeting Dates'[Meeting Date])
VAR PreviousMeetingDate =
CALCULATE(
MAX('Meeting Dates'[Meeting Date]),
FILTER(
ALL('Meeting Dates'),
'Meeting Dates'[Meeting Date] < CurrentMeetingDate
)
)
VAR TasksBetweenDates =
CALCULATETABLE(
'Tasks',
'Tasks'[Completion Date] > PreviousMeetingDate &&
'Tasks'[Completion Date] <= CurrentMeetingDate
)
RETURN
COUNTROWS(TasksBetweenDates)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Still same results. 

Maybe there is some way to share my pbix to you or it won't help?

Anonymous
Not applicable

Hi @bigk 

 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

Best Regards

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

bigk
Helper II
Helper II

Hello, @rajendraongole1 

Thanks for very quick response. I've tried your suggestions. First of all i think that relationship between meeting dates table and tasks should be present based on your suggestions. So i've made it.

bigk_0-1720003805324.png

 

But unfortunately i'm not getting any results if i report it on meeting date level or on project level.

 

Hi @bigk - Ok, can you try the below measure with out using the userrelationship function to get the

completed tasks between the previous and current meeting dates.

 

Completed Tasks =
VAR CurrentMeetingDate = SELECTEDVALUE('Meeting Dates'[Meeting Date])
VAR PreviousMeetingDate =
CALCULATE(
MAX('Meeting Dates'[Meeting Date]),
FILTER(
ALL('Meeting Dates'),
'Meeting Dates'[Meeting Date] < CurrentMeetingDate
)
)
RETURN
CALCULATE(
COUNTROWS('Tasks'),
FILTER(
'Tasks',
'Tasks'[Completion Date] > PreviousMeetingDate &&
'Tasks'[Completion Date] <= CurrentMeetingDate
)
)

 

Hope it works

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





rajendraongole1
Super User
Super User

Hi @bigk - Can you try the below measure calculation for completed tasks

 

Completed Tasks =
VAR CurrentMeetingDate = SELECTEDVALUE('Meeting dates'[Meeting date])
VAR PreviousMeetingDate =
CALCULATE(
MAX('Meeting dates'[Meeting date]),
'Meeting dates'[Meeting date] < CurrentMeetingDate
)
RETURN
SUMX(
'Projects',
CALCULATE(
COUNTROWS('Tasks'),
'Tasks'[Completion date] > PreviousMeetingDate && 'Tasks'[Completion date] <= CurrentMeetingDate,
USERELATIONSHIP('Tasks'[Completion date], 'Meeting dates'[Meeting date])
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.