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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
insightD
Regular Visitor

Issues with ISINSCOPE

I am computing values in Power Bi using the ISINSCOPE function but not getting the expected result in my total.

insightD_0-1675355145313.png

 

As the image above shows, my values come out correctly in rows but not in the group total or grand total.
I have a measure like so:

 

 

Planned Session Duration = 
  IF (
   ISINSCOPE( DeltaRoom[DeltaRoomCode] ) && ISINSCOPE( xDate[Date] ),
  CALCULATE( MAX( 'Isinscope'[PlannedSessionDuration] ) ), -- get the max planned session duration for this scope
     IF (
         ISINSCOPE( Consultant[ConsultantKey] ) && ISINSCOPE( xDate[Date] ),
         CALCULATE( MAX( 'Isinscope'[PlannedSessionDuration] ) ), -- get the max planned session --duration for this scope
          IF (
                ISINSCOPE( Agency[AgencyName] ) && ISINSCOPE( xDate[Date] ),
                CALCULATE( MAX( 'Isinscope'[PlannedSessionDuration] ) ), -- get the max planned session duration for this scope
                 VAR _PlannedSession =
                   SUMMARIZE( 
                       'Isinscope',
                       'Isinscope'[Date],
                       "PlannedSessionDuration", MAX( 'Isinscope'[PlannedSessionDuration] ) -- get the max value for the scope 
                   )
                   RETURN 
                        SUMX(  _PlannedSession, [PlannedSessionDuration] )  -- return the sum of the max value from the variable to get the total 
          )
   )
)

 

 

Not sure where I am getting it wrong. What I hope to achieve is to get the MAX value of PlannedSessionDuration for each row. The MAX value of each row should be summed up as the total per group in the scope so Efficiency is computed like so:

 

 

 Efficiency = 
       DIVIDE(
       [Planned Duration(Mins)],
      [Planned Session Duration]
   )

 

 

I have attached the file here(.pbix and data file) 

I really appreciate any help you can provide.

1 REPLY 1
lbendlin
Super User
Super User

xDate[Date]  is never in scope as it is not shown in the visual. Therefore always only the last formula is executed.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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