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
PH9Z
Regular Visitor

Number of children with bad marks

I have a simple calculation "Bad Marks":

IF(SUM([table].Value1) < SUM([table].Value2,1,0)

 

I also have a non balanced (ragged) parent child hierarchy:

 

ParentIdOrgIdOrgName
11Company
12Region 1
13Region 2
14Region 3
25Office 1
26Office 2
37Office 3
38Office 4
49Subregion 1
410Subregion 2
911Office 5
912Office 6
1013Office 7
1014Office 9

 

How do I calculate the number of lowest level children with "bad marks" for each node?

 

Something like 

OrgNameNo of bad marks
Company6
Region 11
Region 24
Region 31
Subregion 11
Subregion 20

 

Regards John

2 REPLIES 2
PH9Z
Regular Visitor

Hello Greg,

 

Are you looking for this:

 

OrgStructure Table

 

ParentId OrgId OrgName

1 1 Company
1 2 Region 1
1 3 Region 2
1 4 Region 3
2 5 Office 1
2 6 Office 2
3 7 Office 3
3 8 Office 4
4 9 Subregion 1
4 10 Subregion 2
9 11 Office 5
9 12 Office 6
10 13 Office 7
10 14 Office 9

 

 

Values Table

 

OrgId Value1 Value2
5 1 2
6 2 1
7 3 4
8 4 5
11 4 6
12 7 8
13 19 12
14 4 10

 

Expected Output

 

Company , 3

Region 1,1

Office 1,0
Office 2,1
Region 2,0
Office 3,0
Office 4,0

Region 3, 1
Subregion 1 ,0 

Office 5, 0
Office 6, 0
Subregion 2, 1
Office 7 , 0
Office 9 , 1

 

 

Regards John

Greg_Deckler
Super User
Super User

@PH9Z I feel like I am missing some source data to be able to create the calculation. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors