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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sebastian09
Regular Visitor

Display a dynamic text value based on the selected values on two slicers

Hello everyone,

I'm trying to create a measure in Power Bi Desktop to display a text value based on the selected filter.

 

Take a look at the table:

Report Category Report Category 2
Communication 
Corporate strategyEngineering
Corporate strategyProcurement
ESC 
FinanceGlobal Business Services
FinanceIT
Human Resources 

 

Not every Report Category has a Report Category 2.

I would like to build a measure to display a text based on the four assumptions:

  1. When I choose in slicer only Report Category without existing Report Category 2 for this Report Category (For example Report Category: Communication) the measure will display text: "Report Category & " Expense Report""
  2. When I choose in slicer only Report Category with existing Report Category 2 for this Report Category (For example Report Category: Finance) the measure will display text: "Report Category & " Expense Report""
  3. When I choose in slicer only Report Category 2 (For example Report Category 2: IT - there is only for Finance) the measure will display text: "Report Category 2 & " Expense Report""
  4. When no selection on slicers, the measure will display text: " Global Expense Report"

I wrote this measure in DAX:

 

 

Report name display =
VAR SelectedCategory = SELECTEDVALUE('Sharepoint database'[Report Category])
VAR SelectedCategory2 = SELECTEDVALUE('Sharepoint database'[Report Category 2])
RETURN
IF(
ISBLANK(SelectedCategory),
"Global Expense report",
IF(
ISBLANK(SelectedCategory2),
SelectedCategory & " Expense report",
SelectedCategory2 & " Expense report"
)
)

And it working only on the three assumptions:

2. When I choose in slicer only Report Category with existing Report Category 2 for this Report Category (For example Report Category: Finance) the measure will display text: "Report Category & " Expense Report"".

3. When I choose in slicer only Report Category 2 (For example Report Category 2: IT - there is only for Finance) the measure will display text: "Report Category 2 & " Expense Report"".

4. When no selection on slicers, the measure will display text: " Global Expense Report".

 

But not working for:

 

1. When I choose in slicer only Report Category without existing Report Category 2 for this Report Category (For example Report Category: Communication) the measure will display text: "Report Category & " Expense Report"".

 

Please check screenshots:

1. Selected Report Category: Communication: - there is a problem. Should be "Communications Expense report"

sebastian09_1-1712658668543.png

2. Selected Report Category: Finance

sebastian09_2-1712658717147.png

3. Selected Report Category 2: IT

sebastian09_3-1712658750844.png

4. No selection:

sebastian09_0-1712658623929.png

 

Many thanks for your help.

1 ACCEPTED SOLUTION
Wilson_
Super User
Super User

Hi Sebastian,

 

I think the base problem is you think SELECTEDVALUE does something different than what it actually does. It doesn't actually check that you've selected a value; it checks that there is only a single value for that column. This happens when you make a single selection in a slicer of course, but it's not the only way. (For more details, check out the documentation here.)

 

When you select Communications from Report Category, Report Category 2 is not blank. As you can see in your first screenshot, when you select Communications, Report Category 2 has only one value (""), therefore SelectedCategory2 is not blank, ISBLANK ( SelectedCategory2 ) returns FALSE and your measure returns SelectedCategory2 & " Expense report".

 

The DAX function it seems you are actually looking for is ISFILTERED. (I'm also using SWITCH instead of nested IF functions, for readability.)

 

Following the logic you laid out at the top of your post, what your logic flow in your measure should be is:

Report name display =
VAR SelectedCategory = SELECTEDVALUE ( 'Sharepoint database'[Report Category] )
VAR SelectedCategory2 = SELECTEDVALUE ( 'Sharepoint database'[Report Category 2] )
VAR Result =
SWITCH (
    TRUE(),
    ISFILTERED ( 'Sharepoint database'[Report Category] ), SelectedCategory & " Expense Report",
    ISFILTERED ( 'Sharepoint database'[Report Category 2] ), SelectedCategory2 & " Expense Report",
    "Global Expense Report"
)

RETURN Result

 

I would also recommend you set your slicers to single selections because I don't think you intend users to select more than one. Therefore, don't give them that option. 😄


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




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

Proud to be a Super User!





View solution in original post

3 REPLIES 3
Wilson_
Super User
Super User

Hi Sebastian,

 

I think the base problem is you think SELECTEDVALUE does something different than what it actually does. It doesn't actually check that you've selected a value; it checks that there is only a single value for that column. This happens when you make a single selection in a slicer of course, but it's not the only way. (For more details, check out the documentation here.)

 

When you select Communications from Report Category, Report Category 2 is not blank. As you can see in your first screenshot, when you select Communications, Report Category 2 has only one value (""), therefore SelectedCategory2 is not blank, ISBLANK ( SelectedCategory2 ) returns FALSE and your measure returns SelectedCategory2 & " Expense report".

 

The DAX function it seems you are actually looking for is ISFILTERED. (I'm also using SWITCH instead of nested IF functions, for readability.)

 

Following the logic you laid out at the top of your post, what your logic flow in your measure should be is:

Report name display =
VAR SelectedCategory = SELECTEDVALUE ( 'Sharepoint database'[Report Category] )
VAR SelectedCategory2 = SELECTEDVALUE ( 'Sharepoint database'[Report Category 2] )
VAR Result =
SWITCH (
    TRUE(),
    ISFILTERED ( 'Sharepoint database'[Report Category] ), SelectedCategory & " Expense Report",
    ISFILTERED ( 'Sharepoint database'[Report Category 2] ), SelectedCategory2 & " Expense Report",
    "Global Expense Report"
)

RETURN Result

 

I would also recommend you set your slicers to single selections because I don't think you intend users to select more than one. Therefore, don't give them that option. 😄


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




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

Proud to be a Super User!





Hi Wilson,

thank you for your response.

I'm very grateful for your explanation about SELECTEDVALUE formula.

 

Albo, you have right about multiple selection on the slicer, bout please be informad, thet was only for preview, in the official version I used only single selection slicer.

 

Many thank you for your DAX measure. Everything working without issues.

 

Kind regards,

Sebastian

Sebastian,

 

Perfect, thanks for the update. Happy I could help. 😄




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

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors