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

Filtering a dataset by only a specific ID to create a cumulative total cost curve.

Hi there,

 

New to PowerBI and first attempt at creating a report.

I have merged a few tables together to create the table below.

 

MergedTaskResource

rtask_prop_id:IDTitleComplianceAssetIdresource_nameresource_idoverride_sell_raterole_grouprole_namecost_rate_salaryregionnum_hoursrtask_prop_idIdresource_phase_fk:IDresource_phase_fkIdrtask_idIdonshoredescriptionrtask_id:IDfull_loaded_costtotalbusiness unitcommentsID.1ModifiedCreatedGUIDrtask_prop_idresource_phase_fkrtask_idTasks.IdTasks.TitleTasks.phase_fkIdTasks.task_numberTasks.start_dateTasks.end_dateTasks.task_name_calcTasks.AuthorIdTasks.EditorIdDayDifferenceAverageCost
15nullnullNAME 0EngineersEngineer Australia1008446onshoreEngineer630026674.25nullnull1527/06/2019 10:55:53 PM27/06/2019 10:55:53 PM   6new name PW41nullnullnew name PW1818null0

 

Capture.PNG
I am interested in producing a cost over time graph based on proposal id which is the first field as the table has many rows from many different IDs. I have managed to create a manual cost over time graph for a specific ID, which I have hardcoded in a filter " MergedTaskResource[rtask_prop_id:ID]="3" ".

DailyCost = CALCULATE( SUM(MergedTaskResource[AverageCost]) , FILTER( MergedTaskResource, AND([Adjusted Dates]<=MergedTaskResource[Tasks.end_date], [Adjusted Dates]>=MergedTaskResource[Tasks.start_date])), FILTER( MergedTaskResource, MergedTaskResource[rtask_prop_id:ID]="3"))

 

I was wondering if there was a way to generalise the filtering so it worked for proposal IDs of any value that the user could select in the report rather than changing the code above.

Is there also a dynamic way to create the start and end dates for the line chart, as the current proposal actually finishes on 30 July 2019 and starts 30th June but the line chart goes from earlier June to September.

 

To give a bit more context, I have attached the steps I've used to create the cumulative costs above.

 

 

To do the following, two calculated columns DayDifference and average daily cost was added to the table MergedTaskResources.

A separate Calender table was used to do the daily calculation, in this same table I have added a few more calculated columns to create the table below.

 

Capture2.PNG

 

DailyCost

DailyCost = CALCULATE( SUM(MergedTaskResource[AverageCost]) , FILTER( MergedTaskResource, AND([Adjusted Dates]<=MergedTaskResource[Tasks.end_date], [Adjusted Dates]>=MergedTaskResource[Tasks.start_date])), FILTER( MergedTaskResource, MergedTaskResource[rtask_prop_id:ID]="3"))

Adjusted Dates

Adjusted Dates = 'Dates'[Date] - (10/24)

Cumulative Total

Cumulative Total = CALCULATE( SUM(Dates[DailyCost]), 'Dates'[Adjusted Dates] <= EARLIER ('Dates'[Adjusted Dates]))

 

Thanks!

Here is some sample data,

IdTitleComplianceAssetIdresource_nameresource_idoverride_sell_raterole_grouprole_namecost_rate_salaryregionnum_hoursrtask_prop_idIdresource_phase_fk:IDresource_phase_fkIdrtask_idIdonshoredescriptionrtask_id:IDrtask_prop_id:IDfull_loaded_costtotalbusiness unitcommentsID.1ModifiedCreatedGUIDrtask_prop_idresource_phase_fkrtask_idTasks.IdTasks.TitleTasks.phase_fkIdTasks.task_numberTasks.start_dateTasks.end_dateTasks.task_name_calcTasks.AuthorIdTasks.EditorIdDayDifferenceAverageCost
156nullnull  150   Australia03272727onshore 27398.40 test15630/07/2019 1:43:24 AM23/07/2019 11:07:27 PM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One131390
157nullnull  0   Australia13272727onshore 273100.08110.088 null15724/07/2019 11:00:05 PM23/07/2019 11:07:55 PM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313912.232
158nullnull  0   Australia53272727onshore 27398.4541.2 null15824/07/2019 10:59:06 PM24/07/2019 1:25:55 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313960.13333
161nullnull  0   Australia53272727onshore 273100.08550.44 null16124/07/2019 10:59:07 PM24/07/2019 1:40:06 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313961.16
163nullnull  0   Australia53272727onshore 273100.08550.44 null16324/07/2019 10:59:09 PM24/07/2019 2:20:47 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313961.16
168nullnull  0   Australia53272727onshore 273100.08550.44 null16824/07/2019 10:59:11 PM24/07/2019 4:46:51 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313961.16
169nullnull  0   Australia13272727onshore 273100.08110.088 null16924/07/2019 11:00:06 PM24/07/2019 4:50:20 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313912.232
400nullnull  0   Australia13272728onshore 28398.4108.24 null40031/07/2019 3:59:32 AM31/07/2019 3:59:32 AM   28Task Two2728/07/2019 2:00:00 PM14/07/2019 2:00:00 PMTask Two1313715.46286
170nullnull  0   Australia13282829onshore 293100.08110.088 null17024/07/2019 11:00:09 PM24/07/2019 4:50:21 AM   29Task One Phase Two28110/07/2019 2:00:00 PM10/07/2019 2:00:00 PMTask One Phase Two13131110.088
401nullnull  0   Australia132727135onshore 135398.4108.24 null40131/07/2019 3:59:33 AM31/07/2019 3:59:33 AM   135Task 327318/07/2019 2:00:00 PM30/07/2019 2:00:00 PMTask 31313138.326154
156nullnull  150   Australia03272727onshore 27498.40 test15630/07/2019 1:43:24 AM23/07/2019 11:07:27 PM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One131390
157nullnull  0   Australia13272727onshore 274100.08110.088 null15724/07/2019 11:00:05 PM23/07/2019 11:07:55 PM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313912.232
158nullnull  0   Australia53272727onshore 27498.4541.2 null15824/07/2019 10:59:06 PM24/07/2019 1:25:55 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313960.13333
161nullnull  0   Australia53272727onshore 274100.08550.44 null16124/07/2019 10:59:07 PM24/07/2019 1:40:06 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313961.16
163nullnull  0   Australia53272727onshore 274100.08550.44 null16324/07/2019 10:59:09 PM24/07/2019 2:20:47 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313961.16
168nullnull  0   Australia53272727onshore 274100.08550.44 null16824/07/2019 10:59:11 PM24/07/2019 4:46:51 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313961.16
169nullnull  0   Australia13272727onshore 274100.08110.088 null16924/07/2019 11:00:06 PM24/07/2019 4:50:20 AM   27Task One27130/06/2019 2:00:00 PM8/07/2019 2:00:00 PMTask One1313912.232
400nullnull  0   Australia13272728onshore 28498.4108.24 null40031/07/2019 3:59:32 AM31/07/2019 3:59:32 AM   28Task Two2728/07/2019 2:00:00 PM14/07/2019 2:00:00 PMTask Two1313715.46286
170nullnull  0   Australia13282829onshore 294100.08110.088 null17024/07/2019 11:00:09 PM24/07/2019 4:50:21 AM   29Task One Phase Two28110/07/2019 2:00:00 PM10/07/2019 2:00:00 PMTask One Phase Two13131110.088
401nullnull  0   Australia132727135onshore 135498.4108.24 null40131/07/2019 3:59:33 AM31/07/2019 3:59:33 AM   135Task 327318/07/2019 2:00:00 PM30/07/2019 2:00:00 PMTask 31313138.326154

 

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

@Anonymous 

 

You may use ALLSELECTED as a CALCULATE modifier and add an appropriate measure to Visual level filters to adjust the time axis.

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

View solution in original post

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may use ALLSELECTED as a CALCULATE modifier and add an appropriate measure to Visual level filters to adjust the time axis.

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

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.