Forum Discussion
Parent child aggregation DAX code not working
In the 1st post i had given all details of data which got lost as i got some error, same happened 2nd time. 3rd time i kept it short
Anyways here is my data,
DimLocation
| LocationID | Location | Parent Location ID |
| 1 | North America | NULL |
| 2 | USA | 1 |
| 3 | Florida | 2 |
| 4 | Miami | 3 |
| 5 | Fort Myers | 3 |
| 6 | Canada | 1 |
| 7 | Ontario | 6 |
| 8 | Toronto | 7 |
DimAmountType
| AmountTypeID | Amount Type |
| 1 | Registration Fees |
| 2 | License Fees |
| 3 | Product Cost |
FactAmount
| FactKey | LocationID | AmountTypeID | Amount |
| 1 | 1 | 3 | 1000 |
| 2 | 2 | 1 | 250 |
| 3 | 4 | 2 | 150 |
| 4 | 5 | 2 | 100 |
| 5 | 6 | 3 | 1500 |
| 6 | 7 | 3 | 1200 |
| 7 | 8 | 1 | 300 |
| 8 | 8 | 2 | 200 |
amarsale85 , refer if these can help
- amarsale856 years ago
Helper II
Thank you for the help but unfortunately this doesn't help me.
I should be able to show data in chart as shown below:
Here you can see, All Locations selected are from different levels, but are seen besides each other, that is no drill down.
- Anonymous6 years agoNot applicable
Hi amarsale85 ,
First, please make sure those 3 tables have created relationships as below screen shot. Then create a stacked column chart (Axis: Location in table DimLocation, Legend: Account Type in DimAccountType and Values: Amount in table FactAmount ).
Create relationshipsCreate visual
Best Regards
Rena
- amarsale856 years ago
Helper II
Thank you for taking time to answer by question. But it isn't the expected behavior.
In your Chart, you can see North America to have lower profit amount than Canada & Ontario, which is wrong because,
State/Province = Aggregation/Summation of amount of all its Children cities
Country = Aggregation/Summation of amount of all its Children States/Provinces
Continent = Aggregation/Summation of amount of all its Children countries