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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
a0k08ac
New Member

Dynamic Text Box based on 2 slicers

Hello,

I have 2 slicers and the I want the result text box in such a way that if I select the first slicer and don't select any option from the second slicer, the text should be based on only the selected first slicer option. Now comes the complicated part where if I keep the selected first slicer option and then also select an option from the second slicer, the text should only display the value of the second slicer.

 

Example -

Slicer 1 options -> A,B,C,D

Slicer 2 options -> P,Q,R,S

 

If I select slicer 1 option A and don't select anything from slicer 2, result should be A

If I keep the slicer 1 as A and also select for example Q from slicer 2, result should be Q

 

One thing to note is that the slicer 1 is connected to slicer 2 in such a way that whenever I select any option from slicer 1, options are filtered for slicer 2.

 

I am having a hard time to design a DAX formula for this.

 

Thanks!

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Something like this should work:

Text Measure =
VAR varFirstSlicer =
    SELECTEDVALUE( Table[Field] )
VAR varSecondSlicer =
    SELECTEDVALUE( Table[Field2] )
VAR Result =
    IF(
        ISBLANK( varSecondSlicer ),
        varFirstSlicer,
        varSecondSlicer
    )
RETURN
    Result

If the second slicer has anything but 1 value selected, you'll get the first slicer value.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
a0k08ac
New Member

It worked, thank you!

Awesome. SELECTEDVALUE() is one of my favorite functions. If you have 1 value selected it returns it. If you have 2+ or none selected, it returns blank.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
edhans
Super User
Super User

Something like this should work:

Text Measure =
VAR varFirstSlicer =
    SELECTEDVALUE( Table[Field] )
VAR varSecondSlicer =
    SELECTEDVALUE( Table[Field2] )
VAR Result =
    IF(
        ISBLANK( varSecondSlicer ),
        varFirstSlicer,
        varSecondSlicer
    )
RETURN
    Result

If the second slicer has anything but 1 value selected, you'll get the first slicer value.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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