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
gandalfuy
Regular Visitor

Total hours per employee, per week

I have the following table:

 

Client | Hours | Month

 

A | 2 | April

B | 3 | April

B | 1 | April

A | 1 | May

A | 2 | May

B | 1 | May

B | 3 | May

 

Client A should have a maximum hours per month of 2 and Client B should have a maximum hours per month of 3.

So I want to filter each client that exceeded the maximum hours per month.

For April should appear in a combo box: only B. And for May should appear A and B.

How can I do that? Thanks!

 

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

 
I test with measures as follows
 
Measure 1 = CALCULATE(SUM(Sheet1[Hours]),ALLEXCEPT(Sheet1,Sheet1[Month],Sheet1[Client]))
Measure 2 = IF((MAX([Client])="A"&&([Measure 1])>2)||(MAX([Client])="B"&&[Measure 1]>3),1,0)
 1.png
 
 
Then add filters to visual by letting Measure 2 equal to 1.
 
 2.png
 
Best Regards
Maggie

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

 
I test with measures as follows
 
Measure 1 = CALCULATE(SUM(Sheet1[Hours]),ALLEXCEPT(Sheet1,Sheet1[Month],Sheet1[Client]))
Measure 2 = IF((MAX([Client])="A"&&([Measure 1])>2)||(MAX([Client])="B"&&[Measure 1]>3),1,0)
 1.png
 
 
Then add filters to visual by letting Measure 2 equal to 1.
 
 2.png
 
Best Regards
Maggie
ElliotP
Post Prodigy
Post Prodigy

@gandalfuyAssuming you have a date table, the easiest solution would be to create a measure which sums the hours column and then place that measure in the 'visual' or 'page' filter of your report adjusting for your requirements.

 

That's a very basic solution, you might need something more long term/re-usable. A pbix with a richer description/use case would be pretty handy.

gandalfuy
Regular Visitor

I have the following table:

 

Client | Hours | Month

 

A | 1 | April

B | 2 | April

A | 2 | April

A | 2 | May

B | 2 | May

A | 1 | May

B | 2 | May

 

Client A should have a maximum hours per month of 2 and Client B should have a maximum hours per month of 3.

I need a filter which shows each Client that reached the maximum hours per month. In the case of April should appear A. And in the case of May should appear A and B.

How can I do that?. Thanks!

 

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.