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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

dynamic titles with conditions

Hi every one,
I'm new on power bi and I'm trying to figure out how I can make dynamic titles with these conditions:

 

" Dashboard for" &
- IF no departemnt  is seleted (just the selected value of the colomn departments), I want to see "All departemnts"
- IF 1 department is selected then I want the departement name
- IF more than 2 departemnts are selected then it must show " Many departemnts"

Thanks in advance.

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Anonymous ,

 

I would do it like that:

myDepartmentName =
"Dashboard for"
    & SWITCH( TRUE(),
        NOT ( ISCROSSFILTERED( MyTable[departments] ) ), " All departemnts",
        COUNTROWS( ALLSELECTED( MyTable[departments] ) ) > 1, " Many departemnts",
        SELECTEDVALUE( MyTable[departments] )
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

@selimovd No, I dont use hierarchy in any slicer. Actually I'm not working with slicers but filters. This is how it comes when I choose more than one departmnts.

Hey @Anonymous ,

 

that should still work.

Can you show me the measure you used? Maybe I can see a reason there.

 

Best regards

Dens

Anonymous
Not applicable

Sure. Here is the measure I used:

= "Dashboard for - " &
SWITCH( TRUE(),
NOT( HASONEVALUE( DimDep[Departmnts]) ), " All departmnts",
COUNTROWS(VALUES(DimDep[Departmnts])) > 1, " Many departmnts",
SELECTEDVALUE(DimDep[Departmnts]
)

Thanks,

Hey @Anonymous ,

 

you didn't use the measure I proposed. That's the reason the result is different 😉

Try to use the one I proposed:

myDepartmentName =
"Dashboard for - "
    & SWITCH( TRUE(),
        NOT ( ISCROSSFILTERED( DimDep[Departmnts] ) ), "All departemnts",
        COUNTROWS( ALLSELECTED( DimDep[Departmnts] ) ) > 1, "Many departemnts",
        SELECTEDVALUE( DimDep[Departmnts]Hey )
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
ERD
Super User
Super User

Hello @Anonymous ,

You can try this measure:

dyn_title = 
IF(NOT(ISCROSSFILTERED(T[Department])), 
"All departments",
SELECTEDVALUE(T[Department], "Many departments"))

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

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

selimovd
Super User
Super User

Hey @Anonymous ,

 

I would do it like that:

myDepartmentName =
"Dashboard for"
    & SWITCH( TRUE(),
        NOT ( ISCROSSFILTERED( MyTable[departments] ) ), " All departemnts",
        COUNTROWS( ALLSELECTED( MyTable[departments] ) ) > 1, " Many departemnts",
        SELECTEDVALUE( MyTable[departments] )
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

Anonymous
Not applicable

Thanks for your assistance @selimovd. I try your example,  but when I select more than 1 value, it's showing me "All departmnts" instead of "Many departmnts". How can I fix that please? 

Hey @Anonymous ,

 

do you use a hierarchy in your slicer? Can you send me a screenshot of your solution?

For me it works, like this you wanted it, right:

departments.gif

 

Best regards

Denis

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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