cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
slanka Regular Visitor
Regular Visitor

Dynamically change the title through filter selection

Hello All,

 

I need to change the title dynamically when filter selection is changed.

 

1. When the report open (no specific projects are selected) it should display "All"

2. When ONLY one project is selected, it should display that specific project name

3. When more than one project is selected, it should display "Multiple"

 

To achieve this, below is my approach,

 

SeletedProject =
var allcount = COUNTX(ALL(Table1[Project Name]),Table1[Project Name])
var currentcount = COUNTX(Table1,SELECTEDVALUE(Table1[Project Name]))
var selectedproject = SELECTEDVALUE(Table1[Project Name])
RETURN
IF(ISBLANK(selectedproject),"All",IF(currentcount > 1 && currentcount < allcount, "Multiple",selectedproject))

 

However, I was able to get "All" and specific project name, but not "Multiple" when i selected more than one project. Insteas it's showing me "All", when i selected multiple projects.

 

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Dynamically change the title through filter selection

@slanka Please try changing your measure as below

 

SeletedProject =
var allcount = COUNTX(ALL(Table1[Project Name]),Table1[Project Name])
var currentcount = CALCULATE(COUNTROWS(Table1),ALLSELECTED(Table1[Project Name]))
var selectedproject = SELECTEDVALUE(Table1[Project Name])
RETURN
IF(currentcount=1,selectedproject,IF(currentcount=allcount,"All","Multiple"))

image.pngimage.pngimage.png



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

Proud to be a Datanaut !





View solution in original post

3 REPLIES 3
synergised Member
Member

Re: Dynamically change the title through filter selection

Not exactly what you are looking for.. but have you tried COUNTROWS(ALLSELECTED))?

 

 

Shows either a single college name or College (M) if  multiple selected

-College Name- = IF (COUNTROWS(ALLSELECTED(View_RefCollegeOfInterest[College Short Name])) > 1, "College (M)", FIRSTNONBLANK(View_RefCollegeOfInterest[College Of Interest], ALLSELECTED(View_RefCollegeOfInterest[College Of Interest])))
Highlighted
Super User
Super User

Re: Dynamically change the title through filter selection

@slanka Please try changing your measure as below

 

SeletedProject =
var allcount = COUNTX(ALL(Table1[Project Name]),Table1[Project Name])
var currentcount = CALCULATE(COUNTROWS(Table1),ALLSELECTED(Table1[Project Name]))
var selectedproject = SELECTEDVALUE(Table1[Project Name])
RETURN
IF(currentcount=1,selectedproject,IF(currentcount=allcount,"All","Multiple"))

image.pngimage.pngimage.png



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

Proud to be a Datanaut !





View solution in original post

slanka Regular Visitor
Regular Visitor

Re: Dynamically change the title through filter selection

I had to do a little tweak of using DISTINCTCOUNT based on my dataset. Other than that this formula works perfect..!! THank you so much!

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 126 members 1,416 guests
Please welcome our newest community members: