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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

!Creating a measure referencing other measures

Hi Team, 

 

I'm trying to create a measure using an already created measure to calculate an allocation percentage. I have a list of child contracts that roll up into parent contracts (some have no parent contract) and I need to identify the allocation that each child contract has in relation to the parent.

 

I created a measure to identify the denominator in the function ("Active Child Count") using the DISTINCTCOUNT formula. However, now I'm struggling to create the second measure of the allocation-- I tried using DIVIDE([count of contract],[Active Child Count],1) but this is showing me that all contracts have a 100% allocation, which isn't accurate. 

 

Below is the table I'm expecting to see based on sample contracts/data:

Contract IDParent ContractActive Child Count% Allocation
123456A12230250%
789101A12230250%
123412B166781100%
123433-0100%

 

Still a new power BI user so I apologize if I've botched any of the terminology, but greatly appreciate any guidance here.

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

#1, You can try to use the following formula to calculate active contract id.

Active Percent =
CALCULATE (
    COUNT ( Table[Contract ID] ),
    FILTER ( ALLSELECTED ( Table ), [Status] = "Active" ),
    VALUES ( Table[Parent Contract] )
)

#2, You can remove the allselected function to limit the calculation on current row content and invoke the above measure results.

Allocation of Parent Percent =
DIVIDE (
    CALCULATE (
        COUNT ( Table[Contract ID] ),
        FILTER ( Table, [Status] = "Active" ),
        VALUES ( Table[Parent Contract] )
    ),
    [Active Percent],
    0
)

Regards,

Xiaoxin Sheng

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

@selimovd meant to tag you in the above

@Anonymous can you show us the measure?

Anonymous
Not applicable

@selimovd 

 

Sorry, let me start over... 

 

I have the following columns in my data source:

 

Contract IDParent ContractStatus
123456A12230Active
789101A12230Active
827381A12230Active
647325A12230Terminated
123412B16678Active
123433-Active

 

I'm trying to create two measures to be used in a report table that lists all Contract IDs with the associated measures:

 

Measure #1: Count all active child contracts for each parent contract. If I did this in excel, I'd simply pivot the data to show each parent contract and count the active child contracts associated with each. What is the best measure in Power BI for this type of count?

 

Measure #2: Create an allocation using measure #1 as the denominator (i.e. total active contracts per pool). Since this will be a measure applied to the table with each contract as a row, I'd expect the numerator to be 1 (i.e. each contract).

 

With the proper formulas, I'd expect the following outcome for each measure:

Contract IDParent ContractStatusMeasure #1: Active Child in Parent ContractMeasure #2: Allocation of Parent Contract
123456A12230Active333%
789101A12230Active333%
827381A12230Active333%
647325A12230Terminated00%
123412B16678Active1100%
123433-Active1100%

 

Does that make more sense?

Anonymous
Not applicable

Hi @Anonymous,

#1, You can try to use the following formula to calculate active contract id.

Active Percent =
CALCULATE (
    COUNT ( Table[Contract ID] ),
    FILTER ( ALLSELECTED ( Table ), [Status] = "Active" ),
    VALUES ( Table[Parent Contract] )
)

#2, You can remove the allselected function to limit the calculation on current row content and invoke the above measure results.

Allocation of Parent Percent =
DIVIDE (
    CALCULATE (
        COUNT ( Table[Contract ID] ),
        FILTER ( Table, [Status] = "Active" ),
        VALUES ( Table[Parent Contract] )
    ),
    [Active Percent],
    0
)

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

@selimovd 

 

Source Tables: 

CRM Report = contains population of all child contracts

Parent Contract Pivot = listing of all active child contracts and associated parent contract

 

Measure for numerator: 

Count of Contracts = CALCULATE(COUNTROWS(DISTINCT('CRM Report'[CONTRACT_ID])))
^ should provide a count of 1 for each contract listing in a table. Having no issues with this.
 
Measure for denominator:
Active Child Count = DISTINCTCOUNT('Parent Contract Pivot__'[CONTRACT_ID])
^ applied this to a report table using parent contract as value & brought in measure to count # of child contracts for each parent with no issue. Having the issue when I apply this measure to a table with child contract ID as the value.
 
Let me know what else you may need to understand what I'm trying to do... thank you!!
 

@Anonymous 

 

I lost track what you want to do. Maybe I'm too stupid, but in every post the columns are called a little different. Once [count of contract], then [Active Child Count], then [Contract] and [Parent Contract].

 

Can you please post an easy-to-understand summary of your problem with a table with your Contract ID and all the measures and columns you are using?

 

By the way, COUNTROWS(DISTINCT and DISTINCTCOUNT should be the same for your last 2 measures

 

 

Anonymous
Not applicable

Thanks Denis-- good idea.

 

When I do that, the table spins and spins. So now I'm thinking I dont have the correct formula for the denominator. 

 

When I originally ran the measure for Active Child Count, I performed this in a separate report page where I only listed the Parent contracts and performed a DISTINCTCOUNT of the child contracts for each of those-- effectively creating a view similar to a pivot table in excel. 

 

Parent ContractActive Child Count
A122302
B166781

 

When I pull that measure into the original table with all child contracts, it's not able to read a DISTINCTCOUNT for each contract (and if it did, I'd assume the answer would be 1 since it's just looking up to its data source column).

 

Is there a better measure to obtain the denominator of the allocation where the denominator should be the total count of child contracts within a given parent contract?

selimovd
Super User
Super User

Hello @Anonymous ,

 

just put the two measures [count of contract] and [Active Child Count] in the table.

Then you see the values and you know which of both is wrong. Then we can investigate further why the result is not as expected.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors