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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
theonexcent
Frequent Visitor

Doing calculation only at one hierarchy level

I want to display the sum (higlighted in green) only on the line higlighted in yellow. Is there any way of just doing the calculation at this level and displaying it without it going to higher/lower row levels?Screenshot 2023-06-26 085207.png

 

Edit: Noticed I probably should've added some context. Here is what I have come up with so far, using this formula 

 

Cost Labor =
Var TA = SELECTEDVALUE(TrackingAccountsHierarchy[TrackingAccountIDDescription])
RETURN  
SUMX(ActualCost,CALCULATE(ActualCost[Cost Act], TrackingAccountsHierarchy[CostType]="L"))

 

Screenshot 2023-06-26 091833.png

 

I really just need it to output at the yellow line level. Hopefully someone has had this same request out there. 

 

Edit 2: Figured out something else now and I just want to keep updating my post just incase someone out there ever has this issue.

 

Screenshot 2023-06-26 142133.png

 

I still have not figured out how to get the $41,702 only to that specific hierachy level but, if you notice, I was able to get the 36.07 to just that hierarchy. 

 

Here is how I accomplished that:

 

(Formula for number higlighted in red)

 

Q/MH = DIVIDE([Cost Qty Act], [MH Act])
 
Other formulas that are involved in this formula:
 
Cost Qty Act =
VAR ta = SELECTEDVALUE(TrackingAccountsHierarchy[TrackingAccountIDDescription])
RETURN
CALCULATE(SUMX(ActualCost,CALCULATE(sum(ActualCost[CostQuantity]), TrackingAccountsHierarchy[CostType]="I")), ta = TrackingAccountsHierarchy[TrackingAccountIDDescription])
 
MH Act = SUMX(ActualCost, CALCULATE(SUM(ActualCost[RT]) + SUM(ActualCost[OT]) + SUM(ActualCost[DT]), TrackingAccountsHierarchy[CostType]="L"))
 
What I have concluded is that when the cost types are assigned in the original formulas, the third formula will then only output at the hiearchal level. I am in no way a DAX expert so if anyone can explain to me why this happens, that would be great.
 
Still trying to figure out how to get the $41,702 to the yellow line only within the original formula. 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @theonexcent ,

You can create another new measure as below and put this new measure to replace the measure [Cost Labor] on the matrix:

Meascure =
IF (
    ISINSCOPE ( 'TrackingAccountsHierarchy'[TrackingAccountIDDescription] )
        && NOT ( ISINSCOPE ( 'TrackingAccountsHierarchy'[CostType] ) ),
    Meascure =
IF (
    ISINSCOPE ( 'TrackingAccountsHierarchy'[TrackingAccountIDDescription] )
        && NOT ( ISINSCOPE ( 'TrackingAccountsHierarchy'[CostType] ) ),
    [Cost Labor],
    BLANK ()
),
    BLANK ()
)

If the above one can't help you, please provide some raw data in your table  'TrackingAccountsHierarchy' and 'ActualCost' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? By the way, is there any relationship between these two tables? If yes, please provide the related info. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @theonexcent ,

You can create another new measure as below and put this new measure to replace the measure [Cost Labor] on the matrix:

Meascure =
IF (
    ISINSCOPE ( 'TrackingAccountsHierarchy'[TrackingAccountIDDescription] )
        && NOT ( ISINSCOPE ( 'TrackingAccountsHierarchy'[CostType] ) ),
    Meascure =
IF (
    ISINSCOPE ( 'TrackingAccountsHierarchy'[TrackingAccountIDDescription] )
        && NOT ( ISINSCOPE ( 'TrackingAccountsHierarchy'[CostType] ) ),
    [Cost Labor],
    BLANK ()
),
    BLANK ()
)

If the above one can't help you, please provide some raw data in your table  'TrackingAccountsHierarchy' and 'ActualCost' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? By the way, is there any relationship between these two tables? If yes, please provide the related info. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.