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
gunshruthi
Helper I
Helper I

Dynamically change Title based of Multiple selections on single slicer

Hello Team,
@sevenhills @PaulDBrown @amitchandak @SpartaBI @Ashish_Mathur @johnt75 
I have slicer named cost category in which i have 3 fields. My title needs to dynamically change if based on my slicer selection.
IF i select S/T and G/A - title should be " Summary for "SG&A"
IF i select S/T and G/A and COGA - title should be " Summary for COGA and SG&A"
IF i select any one of the slicers it should display " Summary for [selected single slicer value]

Cost category
COGS
S/T
G/A

Can anyone please help me with the measure I have really been trying long for this

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

See if this works for you:

Title =
VAR _SGA = { "S/T", "G/A" }
VAR _All =
    ALLSELECTED ( Slicer[Cost Category] )
RETURN
    SWITCH (
        TRUE (),
        NOT ( ISFILTERED ( Slicer[Cost Category] ) ), "",
        COUNTROWS ( _All ) = 3, "SG&A & COGS",
        COUNTROWS ( INTERSECT ( VALUES ( Slicer[Cost Category] ), _SGA ) ) = 2, "SG&A",
        CONCATENATEX ( VALUES ( Slicer[Cost Category] ), Slicer[Cost Category], ", " )
    )

ST.gif





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

6 REPLIES 6
v-shex-msft
Community Support
Community Support

Hi @gunshruthi,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
sevenhills
Super User
Super User

You can go with @PaulDBrown solution.

 

A small variation to his code

 

Table:

sevenhills_0-1659125111507.png

 

 

 

 

Title = 
var _val = CONCATENATEX ( VALUES ( 'Cost Category'[Cost Category]) , [Cost Category] , ", ")
return switch (
    TRUE()
    , NOT ( ISFILTERED ( 'Cost Category'[Cost Category] ) ), "Summary"
    , _val = "G/A, S/T", "Summary for SG&A"
    , _val = "COGS, G/A, S/T", "Summary for SG&A and COGS"
    , "Summary for " &_val 
)

 

 

 

 

PaulDBrown
Community Champion
Community Champion

See if this works for you:

Title =
VAR _SGA = { "S/T", "G/A" }
VAR _All =
    ALLSELECTED ( Slicer[Cost Category] )
RETURN
    SWITCH (
        TRUE (),
        NOT ( ISFILTERED ( Slicer[Cost Category] ) ), "",
        COUNTROWS ( _All ) = 3, "SG&A & COGS",
        COUNTROWS ( INTERSECT ( VALUES ( Slicer[Cost Category] ), _SGA ) ) = 2, "SG&A",
        CONCATENATEX ( VALUES ( Slicer[Cost Category] ), Slicer[Cost Category], ", " )
    )

ST.gif





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you so much @PaulDBrown  for the solution
Thanks @sevenhills for your valuble time

 

gunshruthi
Helper I
Helper I

@sevenhills  Thanks for the DAX but its not the one which i have requested
I need dynamic title which is coming from only single slicer as you can see in the screenshot.
The values in the slicer are coming from single column based on the selction of values inside slicer my Title should change.
Can you please help me with the DAX query

gunshruthi_0-1659002676611.png

Will be really helpfull. Thank you so much



sevenhills
Super User
Super User

 

I see that you want dynamic title with three kinds of slicers. If it is me, I will do like this ... each slicer must be based on a column. I used the column in the DAX to get the dynamic title.

 

Let us know if it works for your needs: 

 

Dynamic Title = "Summary for " & 
SWITCH (
   TRUE (),

   -- Three condition check
   HASONEVALUE (Table[col1]) && HASONEVALUE(Table[col2]) && HASONEVALUE (Table[col3]) , "COGA and SG & A",
  
 -- Two condition check
   HASONEVALUE (Table[col1]) && HASONEVALUE(Table[col2]), "SG & A",
  
 -- any selected value
   SelectedValue('Table'[Col1], "") &
   SelectedValue('Table'[Col2], "") &
   SelectedValue('Table'[Col3], "") 
  -- Default, added extra, not needed
   & "" 
)

 

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.