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
joshcomputer1
Helper V
Helper V

Measure not being sliced by filter

I have a key named "teams" that has one column of team names.  It has a one to many relationship with table masterall[team]. I used the teams table as the field in the slicer. 

 

When I try to slice this measure...CountofActiveEmployee, it does not slice by team.  Is there a way to modify this to be able to slice *This measure counts the number of active employees based on start and end dates and it works fine by itself but I need it to be able to be sliced. 

 

DateTable1 is my date dimension

 

Count of Active Employee =
VAR endOfPeriod =MAX ( 'DateTable1'[Date] )
VAR startOfPeriod = MIN( 'DateTable1'[Date] )
RETURN
CALCULATE (
COUNTROWS ( MasterAll ),
FILTER (
ALL(MasterAll),
( MasterAll[Start Date] <= endOfPeriod
&& MasterAll[End Date] >= startOfPeriod
&& masterall[title]<>"non-billable"
&& masterall[title]<>"bench")

)
)

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

The likely problem is your ALL clause. You probably want to switch to ALLEXCEPT and include your Teams in your ALLEXCEPT.

 

https://msdn.microsoft.com/en-us/library/ee634795.aspx


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

The likely problem is your ALL clause. You probably want to switch to ALLEXCEPT and include your Teams in your ALLEXCEPT.

 

https://msdn.microsoft.com/en-us/library/ee634795.aspx


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Worked like a charm!

 

Count of Active Employee =
VAR endOfPeriod =MAX ( 'DateTable1'[Date] )
VAR startOfPeriod = MIN( 'DateTable1'[Date] )
RETURN
CALCULATE (
COUNTROWS ( MasterAll ),
FILTER (
ALLexcept(MasterAll, 'Key Teams'[Teams]),
MasterAll[Start Date] <= endOfPeriod
&& MasterAll[End Date] >= startOfPeriod
&& masterall[title]<>"non-billable"
&& masterall[title]<>"bench")

)

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.

Top Solution Authors