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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jarwest
Helper II
Helper II

Calculating % of child tasks missing and including parent tasks with no child tasks

Hey all,

I have a table of items that are related to children items. All items are in the same table, so I calculated a secondary table.

For reference, my initial table looks something like this. I've omitted some coumns unused in the calculation.

 

KeyCategoryBigLevelKeyNameisDoneStatus
1Big1A0In progress
2Medium1B1Done
3Small4C0Not Started
4Big4D0Not Started
5Big5E0Not Started
6Big6F0In Progress
7Medium6G1Done
8Medium6H0In Progress
9Small6I0Not Started
10Small6J0Not Started
11Big11K0In Progress
12Small11L1Done
13Small11M1Done
14Small11N1Done
15Small11O0Not Started

 

With this table in mind, I wanted to add on a column counting up the number of isDone values to get a % complete for each item that was in the Big category.

So, I should have 100% done for A, since it has 1 medium item that is done. I should have 0% for D and E, because D has 1 task that is not done, and E has no tasks.

I came up with the calculated table below, however I am running into an issue where E, and similar rows with no child items, are not showing up in my end result.

 

TableSummarized = SUMMARIZE( FILTER('Table1', Table1[Category] = "Medium"||Table1[Category] = "Small"), Table1[BigLevelKey], "DoneCount", sum(Table1[isDone]),"CountCount", count(Table1[key]),"Status", FIRSTNONBLANK(Table1[Status],1=1),"Key", FIRSTNONBLANK(Table1[key],1=1))
 
With this calculation, I am ending up with a table like the following. The last column is calculated after table creation based on DoneCount / CountCount. Note how item E, with an ID of 5, did not make it over
BigLevelKeyDoneCountCountCountStatuszItemPercentColumn
111In Progress100%
401Not started0%
614In Progress25%
1134In Progress75%

 

The expected output is as follows

BigLevelKeyDoneCountCountCountStatuszItemPercentColumn
111In Progress100%
401Not Started0%
500Not Started0%
614In Progress25%
1134In Progress75%

I need to fix my calculated table so that it brings over item E, which is also in the Big category, even though it has no child items to count and collect info on if they are done or not.

 

Let me know if you have any questions about my problem, any and all advice is greatly appreciated.

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

Hi @jarwest ,

 

Based on the information you have provided, you can follow these steps:

1.Add new table

 

TableSummarized =

SUMMARIZE (

    FILTER ( 'Table', 'Table'[Category] = "Medium" || 'Table'[Category] = "Small" ||'Table'[Category]="Big"),

    'Table'[BigLevelKey],

    "DoneCount", SUM ( 'Table'[isDone] ),

    "CountCount", COUNT ( 'Table'[key] )-1,

    "Status", FIRSTNONBLANK ( 'Table'[Status], 1 = 1 ),

    "Key", FIRSTNONBLANK ( 'Table'[key], 1 = 1 )

)

 

 

2.Add new column

 

PercentColumn =

VAR _1 = 'TableSummarized'[DoneCount] / 'TableSummarized'[CountCount]

RETURN

    IF ( _1 >= 0, _1, 0 )

 

Final output:

vyifanwmsft_0-1703575359771.png

 

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

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

7 REPLIES 7
v-yifanw-msft
Community Support
Community Support

Hi @jarwest ,

 

Based on the information you have provided, you can follow these steps:

1.Add new table

 

TableSummarized =

SUMMARIZE (

    FILTER ( 'Table', 'Table'[Category] = "Medium" || 'Table'[Category] = "Small" ||'Table'[Category]="Big"),

    'Table'[BigLevelKey],

    "DoneCount", SUM ( 'Table'[isDone] ),

    "CountCount", COUNT ( 'Table'[key] )-1,

    "Status", FIRSTNONBLANK ( 'Table'[Status], 1 = 1 ),

    "Key", FIRSTNONBLANK ( 'Table'[key], 1 = 1 )

)

 

 

2.Add new column

 

PercentColumn =

VAR _1 = 'TableSummarized'[DoneCount] / 'TableSummarized'[CountCount]

RETURN

    IF ( _1 >= 0, _1, 0 )

 

Final output:

vyifanwmsft_0-1703575359771.png

 

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

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

ryan_mayu
Super User
Super User

@jarwest 

is this what you want?

Table 2 = 
var tbl=ADDCOLUMNS('Table',"percent",if(maxx(FILTER('Table','Table'[BigLevelKey]=EARLIER('Table'[BigLevelKey])&&'Table'[Status]="Done"),'Table'[Status])="",0,1))
return SUMMARIZE(FILTER(tbl,'Table'[Category]="Big"),'Table'[BigLevelKey],'Table'[Name],'Table'[Status],[percent])

11.PNG





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

Proud to be a Super User!




Hey Ryan_mayu,

 

Not quite. It looks like this is hard coding in percent as a binary value, which isn't exactly what I need. [percent] needs to be the percentage of items associated with the big item in that row that are marked as done under status. I apologize for the poor examples, I've got some big items that have 10-20 medium and small items associated with it, If I have 15 items associated with a big item and 5 are marked done, I would need percent to show %33.333.

 

Let me know if you have any follow up questions. 

the percent column I created can be changed to percentage type. Then you will see 100% and 0%.

if the solution is still not correct, pls update the sample data and the expected output.





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

Proud to be a Super User!




Added additional data. If I can get the total number of items for each big item, and the number of those items that have a status of 'Done', I can make the calculation for percentage on my end with a calculated column just saying 'DoneCount/TotalCount' or something to that effect. Let me know if you need further information from me.

@jarwest 

 

i saw your new sample data 

BigLevelKey DoneCount CountCount Status zItemPercentColumn
1 1 1 In Progress 100%
4 0 1 Not Started 0%
5 0 0 Not Started 0%
6 1 4 In Progress 25%
11 3 4 In Progress

75%

 

how to get the countcout? why both 6 and 11 are 4?

 

 





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

Proud to be a Super User!




Hey, pointing back to the original data set here, there are 5 items labelled 'Big'. The column 'BigLevelKey' is used to determine what Big item the Small and Medium items belong to. 

Big item 1 has a count of 1 because item 2 has a BigLevelKey value of 1. 

Big item 4 has a count of 1 because item 3 has a BigLevelKey value of 4.

Big item 5 has a count of 0 because no items have a BigLevelKey value of 5.

Big item 6 has a count of 4 because items 7, 8, 9, and 10 have a BigLevelKey value of 6.

Big item 11 has a count of 4 because items 11, 12, 13, and 14 has a BigLevelKey value of 11.

 

Additionally, donecount is counting the number of items under a big item that are done.

For example, Big item 6 has 4 items under it, as we mentioned, but only item 7 has a status of 'Done'. Therefore, Big item 6 has a donecount of 1.

 

I hope this helps

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.