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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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