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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ExcelMonke
Super User
Super User

Summarizing Parent in Hierarchy based off row level calculations

Hello,

I am trying to figure out a way to perform calculations on the level of the parent in the hierarchy. For example, I have a current calculation that computes modal visit types at a clinic level, and I want the calculation to sum the clinic level calculations on the parent level (if that makes sense).

The value that I am most interested in is the "Potential Additional Modal Visits" at the operational group level. This *Should*  be a sum of all clinic potential calcuations - not on the parent level. 
The current measure is:

 

Additional Visits at Operational Group Modal Lengths = 
VAR OGMLTYPE1 = MID([Operational Group Modal Type1 Visit],4,10)
VAR OGMLTYPE2 = MID([Operational Group Modal Type2 Visit],4,10)
VAR CLINTYPE1 = MID([Modal Type1 Visit],4,10)
VAR CLINTYPE2 = MID ([Modal Type2 Visit],4,10)

RETURN
(RoundDOwn((([Completed Modal Type1 Visits]*CLINTYPE1)/OGMLTYPE1),0)+ROUNDDOWN((([Completed Modal Type2 Visits]*CLINTYPE2)/OGMLTYPE2),0))-[Completed Modal Visits]

 

The Operational Group Modal Visits are as follows:

 

CALCULATE([Modal Type1 Visit],ALLEXCEPT('Location Dim','Location Dim'[OperationalGroup],'Location Dim'[Clinic]))

 

The Modal Type1 Visit measure is as follows:

 

CONCATENATE(
    "Type1",
    MINX(
    TOPN(
        1,
        ADDCOLUMNS(
            VALUES('Table1'[TypeLength]),
            "Frequency",CALCULATE(COUNT('Table1'[TypeLength]),'Table1'[VisitType]="Type1")
        ),
        [Frequency],
        0
    ),
    'Table1'[TypeLength]
)
)

 

 

Which returns a result as:

Operational GroupClinicModal Type 1 VisitModal Type 2 visitTotal visits at Modal LengthModal visits type 1Modal visits type 2Potential additional modal visits
A Type1AType2A5002003000
 ABCType1AType2A100752550
 DEFType1BType2A250150100250
 GHIType1AType2B40025375100
 JKLType1CType2B1505010050
B Type1AType2A250200500
 MNOType1AType2A50104010
 PQRType1AType2B75651012
 STUType1BType2b101925
C Type1BType2B555050
 VWXType1BType2B505000
 YZAType1BType2B2520510

 

The Intended result is:

Operational GroupClinicModal Type 1 VisitModal Type 2 visitTotal visits at Modal LengthModal visits type 1Modal visits type 2Potential additional modal visits
A Type1AType2A500200300450
 ABCType1AType2A100752550
 DEFType1BType2A250150100250
 GHIType1AType2B40025375100
 JKLType1CType2B1505010050
B Type1AType2A2502005047
 MNOType1AType2A50104010
 PQRType1AType2B75651012
 STUType1BType2b101925
C Type1BType2B5550510
 VWXType1BType2B505000
 YZAType1BType2B2520510

 

Thank you!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





5 REPLIES 5
lbendlin
Super User
Super User

Instead of ALLEXCEPT consider using REMOVEFILTERS to remove the clinic level filter.

Unfortunately it won't allow me to have multiple table arguments in the removefilters function





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Thanks, unfortunately due to size and nature I can't provide sample data. Is there something specifically missing from my original post that would help with a potential solution?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Sorry, cannot help without sample data. I hope someone else can help you further.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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