cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## Count selected values in a slicer

Hi all ,

I'm using

TestSlicerCount =
COUNTROWS(VALUES(FinalTable[Month])) , to count the number of selected values in a slicer with 12 values, works fine but when there are no selections it shows 12 instead of 0. How can i avoid this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I managed to make it work , thank you @amitchandak .

I used this ,

TestSlicerCount = IF(ISFILTERED(FinalTable[Month]), COUNTROWS(VALUES(FinalTable[Month])),0)
6 REPLIES 6
Super User

@Anonymous . try like

countx(allselected(table),table[column])

Or

measure =
Var _1 = countx(allselected(table),table[column])
var _2 = countx(all(table),table[column])

return
if(_1=_2 =0,_1)

Anonymous
Not applicable

That didn't work , it shows the value as 448 now , i had edited the message just before you replied , maybe you can get a better understanding now

Super User

@Anonymous , try

measure =
Var _1 = calculate(distinctCOUNT(table[column]),allselected(table))
var _2 = calculate(distinctCOUNT(table[column]),all(table))

return
if(_1=_2 =0,_1)

Anonymous
Not applicable
Anonymous
Not applicable

I managed to make it work , thank you @amitchandak .

I used this ,

TestSlicerCount = IF(ISFILTERED(FinalTable[Month]), COUNTROWS(VALUES(FinalTable[Month])),0)
New Member

Is it possible to ignore some months for slicer count? so for example count all selected on slicer, except 9,10,11,12
thanks!

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors