Rollup hierarchy's Node Amount

    Hi Qlikers

    I prepare sample to show how can rollup node's amount in hierarchy

    1.png

    to do this  we need two hierarchy:

    one of them hierarchy with CountryName:

                   Hierarchy(ID,ParentID,CountryName,,CountryName,CountryHierarchy,'/',Depth)

    and another one hierarchy with code

                  Hierarchy(ID,ParentID,ChildNodeCode,,ChildNodeCode,CountryHierarchy2,'/',Depth2)

    and at the last we need For loop to assign SalesAmount to each Parent:

                 FOR each i in 17,13,9,5,1

                 ForTBL:

                 LOAD

                 Mid(CountryHierarchy2,$(i),3) as ChildNodeCode,

                 sum(SalesAmount) as Sum_LowerLever_SalesAmount  

                 Resident ResultTable

                 Group by Mid(CountryHierarchy2,$(i),3);

                 NEXT;

     

    in attached file you can find  the sample qvw file

     

    sincerely

    Samane Ramezani