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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rahul_ferns
Helper II
Helper II

Filter Card as per Dropdown Selection

Hello Experts

I need some help and guidance with populating a card as per selection of a dropdown

 

I have a Slicer that lets users select the Year and I have added the Year from the calendar table to the slicer

rahul_ferns_0-1680481956909.png

rahul_ferns_1-1680481980156.png

I have a Card that shows the Year

rahul_ferns_2-1680482031629.png

 

When I make a selection it works and the Year changes to the selection I made, but when I select All in the Slicer, the Year displayed on the Card shows the earliest year in the database

How can I get the card to show All when all is selected in the slicer, and show the Year when selected in the Slicer?

 

Please point me in the right direction

 

Regards

Rah

 

1 ACCEPTED SOLUTION

Hi , @rahul_ferns 

You can try to this ,i may make a mistake for this dax code:

Measure = var _select =COUNTROWS(VALUES('Table'[Year]))
var _total = COUNTROWS(ALL('Table'[Year]))
return
IF(_select = _total ,"all",MIN('Table'[Year]))

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@rahul_ferns , isfiltered can can help

 

if(isfiltered(Table) , <Your current measure>, max(Table[Year]) )

 

Power BI Tutorial: HasOneValue , Isfiltered:
https://youtu.be/cN8AO3_vmlY?t=10120

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

@amitchandak 

Thank you for your reply

I do not have a measure for the year. I am just using the year column from the calendar table in the slicer

 

Hi , @rahul_ferns 

According to your description, you want to show the total year in your card if selected.

You can create a measure like this:

Measure = CONCATENATEX(VALUES('Table'[Year]) , [Year],",")

 

Then you can put this measure on the card visual and then it can meet your need.

vyueyunzhmsft_0-1680572286372.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Hi Aniya

I only want to show the selected Year from the Slicer, but when all is selected in Slicer it should say the word all 

Regards

Rah

Hi, @rahul_ferns 

Accoridng to your description, you want to "when all is selected in Slicer it should say the word all ".

You can try to use this dax code:

Measure =var _select =VALUES('Table'[Year])
var _total = COUNTROWS(ALL('Table'[Year]))
return
IF(_select = _total ,"all",MIN('Table'[Year]))

 

hank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Hi Aniya

Thanks for the reply
I tried it, but when I add the measure to a Card Visual, I am getting the Can't display the visual error

Regards

Rahul

Hi , @rahul_ferns 

You can try to this ,i may make a mistake for this dax code:

Measure = var _select =COUNTROWS(VALUES('Table'[Year]))
var _total = COUNTROWS(ALL('Table'[Year]))
return
IF(_select = _total ,"all",MIN('Table'[Year]))

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Perfect, Aniya

Much appreciated

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.