Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 Group | Clinic | Modal Type 1 Visit | Modal Type 2 visit | Total visits at Modal Length | Modal visits type 1 | Modal visits type 2 | Potential additional modal visits |
A | Type1A | Type2A | 500 | 200 | 300 | 0 | |
ABC | Type1A | Type2A | 100 | 75 | 25 | 50 | |
DEF | Type1B | Type2A | 250 | 150 | 100 | 250 | |
GHI | Type1A | Type2B | 400 | 25 | 375 | 100 | |
JKL | Type1C | Type2B | 150 | 50 | 100 | 50 | |
B | Type1A | Type2A | 250 | 200 | 50 | 0 | |
MNO | Type1A | Type2A | 50 | 10 | 40 | 10 | |
PQR | Type1A | Type2B | 75 | 65 | 10 | 12 | |
STU | Type1B | Type2b | 10 | 1 | 9 | 25 | |
C | Type1B | Type2B | 55 | 50 | 5 | 0 | |
VWX | Type1B | Type2B | 50 | 50 | 0 | 0 | |
YZA | Type1B | Type2B | 25 | 20 | 5 | 10 |
The Intended result is:
Operational Group | Clinic | Modal Type 1 Visit | Modal Type 2 visit | Total visits at Modal Length | Modal visits type 1 | Modal visits type 2 | Potential additional modal visits |
A | Type1A | Type2A | 500 | 200 | 300 | 450 | |
ABC | Type1A | Type2A | 100 | 75 | 25 | 50 | |
DEF | Type1B | Type2A | 250 | 150 | 100 | 250 | |
GHI | Type1A | Type2B | 400 | 25 | 375 | 100 | |
JKL | Type1C | Type2B | 150 | 50 | 100 | 50 | |
B | Type1A | Type2A | 250 | 200 | 50 | 47 | |
MNO | Type1A | Type2A | 50 | 10 | 40 | 10 | |
PQR | Type1A | Type2B | 75 | 65 | 10 | 12 | |
STU | Type1B | Type2b | 10 | 1 | 9 | 25 | |
C | Type1B | Type2B | 55 | 50 | 5 | 10 | |
VWX | Type1B | Type2B | 50 | 50 | 0 | 0 | |
YZA | Type1B | Type2B | 25 | 20 | 5 | 10 |
Thank you!
Proud to be a 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
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?
Proud to be a Super User! | |
Sorry, cannot help without sample data. I hope someone else can help you further.
User | Count |
---|---|
75 | |
74 | |
44 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |