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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.