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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
darko861
Resolver II
Resolver II

Isinscope 2-level calculation

Hi all,

 

I have a table, with two rows displaying the Member's names (which is blurred out) and their Internal or Customer time. The data model consists of the Members' table (The Members' names come from this table) and a fact table called V_EIS_Comined... (There is a column here called InternalorCustomer which categorizes each row as either Internal or Customer ).

 

I have Four measures:

Worked Hours = SUM(v_EIS_Combined_Employee_Company_Time2[Registered_Hours])

Billed Hours = 

IF(SUM(v_EIS_Combined_Employee_Company_Time2[Billed_Hours])=0,BLANK(),SUM(v_EIS_Combined_Employee_Company_Time2[Billed_Hours]))

Targeted Hours = 

SWITCH(TRUE(),SELECTEDVALUE(v_EIS_Combined_Employee_Company_Time2[InternalorCustomer]) = "Customer Time",SUM(Budgeted_Hours[Value]),BLANK())

Diff Hours = 

SWITCH(TRUE(),SELECTEDVALUE(v_EIS_Combined_Employee_Company_Time2[InternalorCustomer]) = "Customer Time",[Billed Hours] -[Targeted Hours],BLANK())
 
The measures seem to be working but only if I expand to the second level displaying time spent between Internal time and Customer time. What I want to see is also the summary or sum of the measures on the first level as well, which is the member's name. E.g In the picture below we see that Customer Time is 113 and Diff Hours is -65 but how can these values also be displayed on the first level where we have the names of the members? I have tried with Isinscope but can't get it right, can you help by tweaking the code a bit?
thanks
 
darko861_0-1675687889742.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@darko861 , Try sum like

 

Targeted Hours =
Sumx(Summarize(v_EIS_Combined_Employee_Company_Time2,v_EIS_Combined_Employee_Company_Time2[InternalorCustomer],v_EIS_Combined_Employee_Company_Time2[Operations]),
SWITCH(TRUE(),SELECTEDVALUE(v_EIS_Combined_Employee_Company_Time2[InternalorCustomer]) = "Customer Time",SUM(Budgeted_Hours[Value]),BLANK()) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@darko861 , Try sum like

 

Targeted Hours =
Sumx(Summarize(v_EIS_Combined_Employee_Company_Time2,v_EIS_Combined_Employee_Company_Time2[InternalorCustomer],v_EIS_Combined_Employee_Company_Time2[Operations]),
SWITCH(TRUE(),SELECTEDVALUE(v_EIS_Combined_Employee_Company_Time2[InternalorCustomer]) = "Customer Time",SUM(Budgeted_Hours[Value]),BLANK()) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi Amit, It still gives the same output as the above print screen. But In your Dax you have referenced,v_EIS_Combined_Employee_Company_Time2[Operations], The members (Operations) come from another table called V_rpt_Member and the InternalorCustomer column comes from a different table called v_EIS_Combined_Employee_Company_Time2. It's a 1-to-many relationship. Still, I cannot manage to display the values from the second-level Customer Time (InternalorCustomer) to first-level Operations (Members), do you have any more suggestions?

 

darko861_0-1675692674514.png

 

I tweaked the code from Amit and broke it up into more measures so I could branch off it.

Now it works:

Targeted Hours2 = SUMX(SUMMARIZE(v_EIS_Combined_Employee_Company_Time2,v_EIS_Combined_Employee_Company_Time2[InternalorCustomer],v_rpt_Member[Member_Full_Name]),[Targeted Hours])

darko861_0-1675696796447.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.