Forum Discussion

MaxSchrijen23's avatar
4 years ago
Solved

Add String value to correct hierarchy levels with ISINSCOPE

Dear all, I want to create a matrix containing a hierarchy level within this matrix. It is a matrix containing Projects, Subprojects and SubSubProjects, then I also want to add a Project leader on e...
  • MFelix's avatar
    MFelix
    4 years ago

    Hi MaxSchrijen23 ,

     

    I have done the following measure:

    Leader Value = 
    LOOKUPVALUE (
        ProjectData[Leader],
        ProjectData[SubSubProjectId],
            SWITCH (
                TRUE (),
                ISINSCOPE ( ProjectHierarchy[SubSubProjects] ), SELECTEDVALUE ( ProjectHierarchy[SubSubProjectId] ),
                ISINSCOPE ( ProjectHierarchy[SubProject] ),
                    CALCULATE (
                        SELECTEDVALUE ( ProjectHierarchy[SubSubProjectId] ),
                        ProjectHierarchy[IsTotal] = 1
                            && ProjectHierarchy[SubProject] = SELECTEDVALUE ( ProjectHierarchy[subProject] )
                    ),
                ISINSCOPE ( ProjectHierarchy[Project] ),
                    CALCULATE (
                        SELECTEDVALUE ( ProjectHierarchy[SubSubProjectId] ),
                        ProjectHierarchy[IsTotal] = 2
                            && ProjectHierarchy[Project] = SELECTEDVALUE ( ProjectHierarchy[Project] )
                    )
            )
    )

     

    Result is below:

    Now you can make some tweaks to hide the values that are blank but don't believe it's the best option.

     

    In this case you need to use a Parent Child hierarchy. Using this post I have made some changes to your model:

     

    Result is below:

    This passes to having your projects table in the following format:

     

     

    I have all the formulas and results in the table ProjectHierarchy (2). Please tell me what you think.

    See attach Excel file and PBIX file.