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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
gbarr12345
Helper V
Helper V

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_
Memorable Member
Memorable Member

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.

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.

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.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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