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
Anonymous
Not applicable

Measure to identify if a value exists in a list?

Hi all

 

I am building dashboards to assist with project managagement in my organisation.

 

At a high level, this consists of a couple of queries - one for our project budget, showing what employees will work on what tasks and for how many hours each week, and a query showing our time sheet data, showing the actual hours spent on each task per week.

 

I would like a measure that highlights when individuals have charged time to the project who are not included in that project's budget.

 

Both queries are structured similiarly, with fields such as [employee name] [employee ID] [sub-project] [hours] [week ending date] etc

 

The measure would be used to create a table visual. 

 

I was thinking some kind of array would be helpful - it should create a virtual list of employees that are meant to be working on a particular week per the budget - and if there are any employees listed in the timesheet data, to only show their names.

 

thanks

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

@Anonymous 

Here is one way of doing it.

First the model:

model.JPG

 

Add a new column to your budget table and Time sheet table: concatenate the values for Employee ID & Project & Sub-project

 

Budget TableBudget TableTimeSheet TableTimeSheet Table

Now create measures to identify which activities were not budgeted:

 

 

 

Non-Budgeted Activities = 
VAR _Budget = VALUES(Budget[BudgetActivity ID])
VAR TSHEET = VALUES(TimeSheet[TimeSheet Activity ID])
RETURN
COUNTROWS(
    EXCEPT(TSHEET, _Budget))
Non-Budgeted Hours = 
VAR _Budget = VALUES(Budget[BudgetActivity ID])
VAR TSHEET = VALUES(TimeSheet[TimeSheet Activity ID])
RETURN
SUMX(EXCEPT(TSHEET, _Budget), [Sum TimeSheet Hours])

 

 

 

And you get this:

result.JPG

 

PS: if you prefer to avoid having to include new columns and use only measures, you can follow this structure for the measures:

Non-Budgeted by measure = 
VAR BudgActID = SELECTCOLUMNS(
             SUMMARIZE(Budget, Budget[Employee ID], Budget[Project], Budget[Sub-project], "PID", 
             Budget[Employee ID] & Budget[Project] & Budget[Sub-project]),
             "PID", [PID])
VAR TSHEETActID = SELECTCOLUMNS(
             SUMMARIZE(TimeSheet, TimeSheet[Employee ID], TimeSheet[Project], TimeSheet[Sub- 
             project], "PID", TimeSheet[Employee ID] & TimeSheet[Project] & TimeSheet[Sub-project]), 
             "PID", [PID])
RETURN
COUNTROWS(EXCEPT(TSHEETActID, BudgActID))

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Ashish_Mathur
Super User
Super User

Hi,

Share some data and show the expected results.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

ok, what have you tried so far?  Are you familiar with the concept of joins, "show items with no data", and disconnected tables?

Anonymous
Not applicable

HI 

 

I have considered using CALCULATE and summing hours in my time-sheet table, filtered by the current week ending and where the budget hours = 0 for that week, but I hoped there might be a more elegant solution that would boost my DAX ability.

 

I am familiar with the concepts you list but i don't know how they could apply to my situation.

 

The data is sensitive therefore I don't want to give an example - it would be nice if someone could provide examples at a conceptual level for now.

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.