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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ruicasaisalves
Regular Visitor

Hide average when slicer not selected

Hello,

 

I need to show the number of requests done, when no user selected on slicer, but when a user is selected, i need to show the number of requests done vs average by user.

 

I tried using :

 

Maker avg =
VAR Users =
    CALCULATE ( DISTINCTCOUNT ( Data[Maker] ), ALL ( Data ) ) -- distinct users
VAR totalLines =
    CALCULATE ( COUNTROWS ( Data ), ALL ( Data ) ) -- distinct requests
VAR filtercheck =
    ISFILTERED ( Tabela[User] ) -- see if the table has one filter             
VAR averagemaker = totalLines / Users -- requests\user = average requests by user
VAR averageif =
    IF ( Data[Maker No] = 0, BLANK (), averagemaker ) -- dont show average to users with no requests  
VAR test1 =
    IF ( filtercheck, averageif, BLANK () ) -- hide filters when we have no user selection
RETURN
    test1

 

 

But despite the slicer is active or not, the average is always displayed.

 

How can i show only the value of requests done, when no filter is selected:

 

1.jpg

And requests done vs average, when a user is selected ?

3.jpg

Many thanks for the help in advance.

 

Regards,

Rui

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ruicasaisalves , Change the condition like this and try

ISFILTERED ( Tabela[User] ) && calculate(count( Tabela[User] ) , allselected(Tabela)) <> calculate(count( Tabela[User] ) , all(Tabela))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @ruicasaisalves  ,

According to your description, I create this data:

v-yangliu-msft_0-1608106309325.png

Here are the steps you can follow:

1. Create measure.

Measure =
var _average_by_user=CALCULATE(AVERAGE('Table'[Maker ]),FILTER(ALL('Table'),'Table'[User]=MAX('Table'[User])))
var _number_of_requests=CALCULATE(SUM('Table'[Maker ]))
return IF(ISFILTERED('Table'[User]),_average_by_user,_number_of_requests)

2. Result

If the slicer is not selected, the_ number_ Of_ Requests, if selected, is displayed_ average_ By_ user

v-yangliu-msft_1-1608106309331.png

You can downloaded PBIX file from here.

 

If my answer is not what you need, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@ruicasaisalves , Change the condition like this and try

ISFILTERED ( Tabela[User] ) && calculate(count( Tabela[User] ) , allselected(Tabela)) <> calculate(count( Tabela[User] ) , all(Tabela))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors