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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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