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

Dynamic Date Filter

Hello,

 

I aim to get a table looking like this:

Table1.PNG

 

Explanation:

The needed Information is stored in 2 tables "projecttasks" and "times".

The estamated time is recorded for each projecttask in table "projecttasks". The actual time is recorded in table "times" with a date and a reference to the specific projecttask. Remaining time is not recorded anywhere and needs to be calculated.

 

This is what i already got:

Table2.PNG

As you can see, the remaining time is calculated correctly. What i need is a date filter to filter the actual time. e.g. i just want to see the actual time in September and October. Later times should be ignored. Correlating the remaining time should be filtered likewise whereas the estimated time should not be affected.

For now, when i filter the date as described above, the estimated time is not affected (correct), the actual time gets filtered (correct) and the remaining time is not filtered (wrong). Thererfore, i get "wrong" calculations:

Table3.PNG

In the above picture i filtered the date and as you can see the actual time is filtered. Now the calculation for remaining time is incorrect (e.g. TP00 4,00 - 11,50 should be - 7,50, shows -22,50) as here all actual times are used and the filter does not affect the column.

Right now "Remaining Time" is a calculated column stored in projecttasks and is calculated like this:

Remaining Time = projecttasks[Estimated Time] - SUMX(times; IF(times[Key] = projecttasks[Key]; times[Actual Time]))

 

Can anyone help me with my problem here?

 

Regards,

Dennis

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

Hi @Anonymous,

 

Please try to create a measure as below. If it doesn't meet your requirement, kindly share your pbix to me.

 

Remaining Time = SUM(projecttasks[Estimated Time]) - SUMX(filter(times,times[Key] = projecttasks[Key]) ,times[Actual Time]))

Capture.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

Please try to create a measure as below. If it doesn't meet your requirement, kindly share your pbix to me.

 

Remaining Time = SUM(projecttasks[Estimated Time]) - SUMX(filter(times,times[Key] = projecttasks[Key]) ,times[Actual Time]))

Capture.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi @v-frfei-msft,

 

Thanks for your help. Your formula is working great.

 

Regards,

Dennis

sdjensen
Solution Sage
Solution Sage

Hi @Anonymous,

 

You main problem is that Remaining is calculated as a column - this column is calculated before you set you period filter, hence it will always return the same no matter what period you select. You will have to calculate Remaining as a measure if it should be affected by the period filter on your actual.

/sdjensen
Anonymous
Not applicable

Hello @sdjensen,

 

Thanks for your answer. I haven't worked with measures yet, so could you give me an example of how i could do the measure as the measure needs data from 2 different tables?

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.