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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Lucivan_B
New Member

How to get a amount from all "child" of a field account in power bi?

Explaining the problem:
I have a table with the accounts and the total value, this is the "fact" table
 
AccountValor
CC1035-19000
CC1284123400
CC1909200
CC10243500
 
 
I also have a table with "account", at first I had only account and parent (almost like a graph). I used a method to get the recursive parents and put in levels: 
 
ParentAccountLevel1Level2Level3Level4
 CC_SharedCC_Shared   
CC_SharedCC_AdmCC_SharedCC_Adm  
CC_AdmCC1035CC_SharedCC_AdmCC1035 
CC_AdmCC1284CC_SharedCC_AdmCC1284 
CC_AdmCC1909CC_SharedCC_AdmCC1909 
 CC_ReportCC_Report   
CC_ReportRCCCC_ReportRCC  
RCCCC_CSC_SoldCC_ReportRCCCC_CSC_Sold 
CC_CSC_SoldCC1909CC_ReportRCCCC_CSC_SoldCC1909
CC_CSC_SoldCC1024CC_ReportRCCCC_CSC_SoldCC1024
 
Obs: account could be in different levels and in differents branches (method path doesn't work), for example:
 
CC_Report -> RCC -> CC_CSC_Sold -> CC1909
 
CC_Shared -> CC_Adm -> CC1909
 
I want a slicer, for example, using "CC_Adm" and returning the total amount, in this case would be:
 
-19000 + 123400 + 200 = 104600
 
The problem: I would like a way to get any account and get all child below this account and create an Income statement unsing level (1,2,3,4) hierarchy to show all below.
 
Any ideias using concatenate or something else. Thank you all.
 
I tried using concatenate and a measure, but always fail using the slicer.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Lucivan_B ,

 

I use an unconnected table and a visual filter, please check if this is your expected output.

vcgaomsft_0-1735108118819.png

The pbix file is attached for your reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Lucivan_B ,

 

I use an unconnected table and a visual filter, please check if this is your expected output.

vcgaomsft_0-1735108118819.png

The pbix file is attached for your reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

suparnababu8
Super User
Super User

Hi @Lucivan_B 

 

If you want to achieve you goal, pls follow below steps

  1. Create a Parent and chaild Hirearchy
  2. Create a new calculated columns path by using this - (Path = PATH(Accounts[Account], Accounts[Parent]))
  3. Then create a mesure to calculate total value by using below measure
    [[Total Value =
    VAR SelectedAccount = SELECTEDVALUE(Accounts[Account])
    VAR AllDescendants =
    CALCULATETABLE(
    Accounts,
    PATHCONTAINS(Accounts[Path], SelectedAccount)
    )
    RETURN
    SUMX(AllDescendants, Accounts[Valor])]]
  4. Add a slocer and drag the Account field from your accounts table.This slicer will allow you to select an account.
  5. Drag above total value measure into a new card.
  6. Create an income statemnet using hierarchy levels, you can use a matrix visual. Add level1,level2,...to to rows and total value measure to vlaues.

Let me know if it works. Thanks

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.