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
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()) )

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()) )

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
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.