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
gbarr12345
Post Prodigy
Post Prodigy

Measure to show only STAFF customers in the table

Hi guys,

 

I'm trying to write a measure that will only show the staff customers in the table without the need for a slicer or visual filter.

 

I have a measure that kind of works but it still shows the customers who are not staff when I want them excluded:

 

gbarr12345_0-1715818657077.png

 

My current measure is below:

 

 

STAFF Customers =
CALCULATE(
    COUNTROWS( 'Dimension_Customer Table'),
    'Dimension_Customer Table'[Customer Class] IN {"Staff"}
)
 
Any help would be appreciated 🙂 

 

1 ACCEPTED SOLUTION

No problem at all.

 

I was just asked by my manager to try that as he wants them to just be able to see the data they're looking for straight away without having to have to use filters but maybe slicers will have to do.

 

Thanks for your help all the same!

View solution in original post

6 REPLIES 6
Wilson_
Super User
Super User

gbarr12345,

 

Add a filter to the visual/page for [STAFF Customers] > 0.


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





How would I add the filter code to my current code would you know?

 

STAFF Customers =
CALCULATE(
    COUNTROWS'Dimension_Customer Table'),
    'Dimension_Customer Table'[Customer Class] IN {"Staff"}
)

gbarr12345,

 

When I say add a filter to the visual/page for [STAFF Customers] > 0, I am not referring to your measure; I am referring to the filter pane on the right.

 

Wilson__0-1715867438595.png


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Oh yeah, I know I can do that but my company are looking to add this filter within the measure to make it easier for the end user.

 

Is it possible to add a rule within the measure without the need to alter that filter pane?

gbarr12345,

 

Maybe I lack imagination but I don't see how that makes it easier for the end user than you applying the filter as the report builder. In any case, I don't believe you can use a measure alone to return fewer rows - unless you add that filter condition to every other measure in the visual........ but at that point, I don't see why it would be better than adding the filter in the filter pane.


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





No problem at all.

 

I was just asked by my manager to try that as he wants them to just be able to see the data they're looking for straight away without having to have to use filters but maybe slicers will have to do.

 

Thanks for your help all the same!

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.