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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dynamic Title based on 3 slicers

Hi all,

I'm trying to create a title based on what is selected on 3 slicers. These 3 slicers are hierarchies. 

 

I want a title that shows which profit centre is selected on the slicer. If Profit centre level 3 is selected it will show "NZ Produce Categories" on the report. 

TheBlacklist_0-1604992713826.png

 

If level 4 is selected the title will show "Covered Crops" rather than what is selected in level 3. As below:

Then when level 5 is selected it would show "Capsicums" 

TheBlacklist_2-1604992817204.png

 

Here is the DAX I've tried so far but not working:

Measure Title =
IF (
    HASONEFILTER ( 'Profit Center'[Profit Center Level 3 Text] ),
    SELECTEDVALUE ( 'Profit Center'[Profit Center Level 3 Text] ),
    IF (
        AND (
            HASONEVALUE ( 'Profit Center'[Profit Center Level 3 Text] ),
            HASONEVALUE ( 'Profit Center'[Profit Center Level 4 Text] )
        ),
        SELECTEDVALUE ( 'Profit Center'[Profit Center Level 4 Text] ),
        IF (
             (
                HASONEVALUE ( 'Profit Center'[Profit Center Level 3 Text] )
                    && HASONEVALUE ( 'Profit Center'[Profit Center Level 4 Text] )
                    && HASONEVALUE ( 'Profit Center'[Profit Center Level 5 Text] )
            ),
            SELECTEDVALUE ( 'Profit Center'[Profit Center Level 5 Text] )
        )
    )
)

Thanks in advanced!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous managed to figure it out. ended up changing the order of the IF statement and it worked!

IF (
    HASONEVALUE ( 'Profit Center'[Profit Center Level 3 Text] )
        && HASONEVALUE ( 'Profit Center'[Profit Center Level 4 Text] )
        && HASONEVALUE ( 'Profit Center'[Profit Center Level 5 Text] ),
    SELECTEDVALUE ( 'Profit Center'[Profit Center Level 5 Text] ),
    IF (
        AND (
            HASONEVALUE ( 'Profit Center'[Profit Center Level 3 Text] ),
            HASONEVALUE ( 'Profit Center'[Profit Center Level 4 Text] )
        ),
        SELECTEDVALUE ( 'Profit Center'[Profit Center Level 4 Text] ),
        IF (
            HASONEFILTER ( 'Profit Center'[Profit Center Level 3 Text] ),
            SELECTEDVALUE ( 'Profit Center'[Profit Center Level 3 Text] ),
            "TG Fresh"
        )
    )
)

Thanks for your help.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@Anonymous managed to figure it out. ended up changing the order of the IF statement and it worked!

IF (
    HASONEVALUE ( 'Profit Center'[Profit Center Level 3 Text] )
        && HASONEVALUE ( 'Profit Center'[Profit Center Level 4 Text] )
        && HASONEVALUE ( 'Profit Center'[Profit Center Level 5 Text] ),
    SELECTEDVALUE ( 'Profit Center'[Profit Center Level 5 Text] ),
    IF (
        AND (
            HASONEVALUE ( 'Profit Center'[Profit Center Level 3 Text] ),
            HASONEVALUE ( 'Profit Center'[Profit Center Level 4 Text] )
        ),
        SELECTEDVALUE ( 'Profit Center'[Profit Center Level 4 Text] ),
        IF (
            HASONEFILTER ( 'Profit Center'[Profit Center Level 3 Text] ),
            SELECTEDVALUE ( 'Profit Center'[Profit Center Level 3 Text] ),
            "TG Fresh"
        )
    )
)

Thanks for your help.

Anonymous
Not applicable

Hi @Anonymous can you share sample PBIX and expected result so I could help? Thanks!

Anonymous
Not applicable

In your first if criteria, why not use And to check the criteria together? Thanks!

Anonymous
Not applicable

Hi @Anonymous thanks for the reply! Are you able to provide an example using the AND function please? I don't think it will work as the first criteria I only want to show "Profit Centre level 3 text" value when this is the only slicer selected.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors