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
soldous
Advocate II
Advocate II

Show records if a condition is fulfilled at least in one slicer selection

Hi all

I have a table with persons and their allocation in each calendar week:

person1week10.8
person1week21
person1week31
.....person1.....week52...
person2week11.2
person2week21
person2week31
...person2...week52...
..........

 

I want to show in table only persons who have at least in one week allocation more than 100% (more than 1). For weeks I have a slicer where you can choose one, more or all weeks. 

So I'm looking for a dax measure which can I add as a table filter.

I went through two solutions but neither one solved my problem.

 

1) calculate average allocation in all selected weeks and if it's more than 100% show values - doesn't work for more than one week

2) calculate a separate measure of each week and then a measure for filtering 

 

IF(WEEK1>0,1,IF(WEKK2>0,1,.....))

 

 It doesn't respect only selected weeks in the slicer.

 

Is there any DAX function or solution which can help me?

Many thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Just change the criteria in the FILTER in my formula. It was not clear at all where the value you wanted to filter by resides or if that's a measure or a column in your table.

Something like this:

 

[Filtering Measure] =
var __onePersonVisible = hasonevalue( Persons[PersonId] )
var __shouldBeSelected =
	not isempty(
		filter(
			values( Weeks[Week] ),
			[Total Allocation] > 1
		)
	)
var __result =
	convert(__shouldBeSelected * __onePersonVisible, boolean)
return
	__result

 


Best
D

View solution in original post

5 REPLIES 5
soldous
Advocate II
Advocate II

@Mariusz @Anonymous 

Thank you very much guys for the response.

Unfortunately, neither solution works for me. I attached a print screen which could help understand what I need.

allocation.png

In the bottom matrix, I have a summary of allocation per weeks. Value is a simple SUM(Allocation) - because one person can have more records in the same week = more project the person is allocated to. In the table above the matrix, I would like to see only persons with the allocation above 100%. So if I select all the weeks I would like to see only the red person. If I select 1st week and any other I would like to see only the red person. If I select anything except 1week I would like to see nothing.

Anonymous
Not applicable

Just change the criteria in the FILTER in my formula. It was not clear at all where the value you wanted to filter by resides or if that's a measure or a column in your table.

Something like this:

 

[Filtering Measure] =
var __onePersonVisible = hasonevalue( Persons[PersonId] )
var __shouldBeSelected =
	not isempty(
		filter(
			values( Weeks[Week] ),
			[Total Allocation] > 1
		)
	)
var __result =
	convert(__shouldBeSelected * __onePersonVisible, boolean)
return
	__result

 


Best
D

That's it! 

Thank you very much!

Anonymous
Not applicable

This measure returns TRUE if the person should be selected and FALSE otherwise.

 

[Filtering Measure] =
var __onePersonVisible = hasonevalue( Persons[PersonId] )
var __shouldBeSelected =
	not isempty(
		filter(
			Persons,
			Persons[Value] > 1
		)
	)
var __result =
	__shouldBeSelected * __onePersonVisible
return
	convert(__result, boolean)

 

 

Best

D

Mariusz
Community Champion
Community Champion

Hi @soldous 

 

Try this Measure

Measure = 
SUMX( 
    'Table', 
    INT( 'Table'[value] > 1 ) 
)

Use as Visual filter like below.

image.png

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

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