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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
tecumseh
Resolver I
Resolver I

Deliver Message To User If Too Many Items Selected Else Bar Chart

Hi all,

I have a Bar Chart on my report page

But it doesn't look good if a user selects multiple channels
I want to deliver a message if channel count > 1, else deliver bar chart

How can I do that?

 

Thanks

w

1 ACCEPTED SOLUTION
v-junyant-msft
Community Support
Community Support

Hi @tecumseh ,

Thanks for hnguy71's reply!
If you mean that when the user makes multiple selections, a pop-up warning will appear, or the original bar chart will be changed to a card chart to display information, then I'm sorry that this is not possible in Power BI.
I can give you a workaround:
Here is my sample data:

vjunyantmsft_0-1739428746442.png

vjunyantmsft_1-1739428752194.png

vjunyantmsft_2-1739428762234.png

Use this DAX to create a measure:

Sum of Value = 
VAR _sum =
CALCULATE(
    SUM('Table'[Value]),
    ALL('Table'),
    'Table'[Channel] <= SELECTEDVALUE(Slicer[Channel]) && 'Table'[ID] = MAX('Table'[ID])
)
RETURN
IF(
    COUNTROWS(VALUES(Slicer[Channel])) > 1, 
    BLANK(), 
    _sum
)

Then create the bar chart (column chart):

vjunyantmsft_3-1739428839019.png

vjunyantmsft_4-1739428845968.png

vjunyantmsft_5-1739428854060.png

Use this DAX to create another measure:

ShowMessage = 
IF(
    ISFILTERED(Slicer[Channel]),
    IF(
        COUNTROWS(VALUES(Slicer[Channel])) > 1, 
        "Please select only one channel to view the bar chart.", 
        BLANK()
    ),
    "Please choose one channel"
)

Then create a Card(New) and put the measure into it:

vjunyantmsft_6-1739428920811.png

vjunyantmsft_7-1739428958157.png

Click Card > Visual > Callout values ​​> Values ​​> enter a space in the field under Show blank as:

vjunyantmsft_8-1739429127936.png

Then go to Cards > Background > Change Transparency to 100%:

vjunyantmsft_9-1739429255332.png

Also close the Border:

vjunyantmsft_10-1739429283655.png


Then overlap the Card (New) and the bar chart:

vjunyantmsft_11-1739429364659.png

And the final output is as below:

vjunyantmsft_12-1739429393107.png

vjunyantmsft_13-1739429401738.png

vjunyantmsft_14-1739429409751.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Bibiano_Geraldo
Super User
Super User

Hi @tecumseh ,

That's a great idea from @v-junyant-msft ! I'd like to expand on it by providing a more detailed explanation while considering the user experience. The goal is to prevent the card from overlapping the column chart when the user wants to make a selection and make the column chart dissapear completely if more than one value was selected in the slicer.

Step 1: Create a Measure to Check Slicer Selection

First, create a measure to check if the slicer has exactly one selected value:

isOneSelected = 
IF(
    HASONEVALUE(financials[Product]), // Use the same field from your slicer that filters the bar chart
    1,
    0
)

Step 2: Modify the Sales Amount Measure

Now, suppose your bar chart displays the total sales amount by country. Modify the sales amount measure as follows:

Sales Amount = 
IF(
    [isOneSelected] = 1,
    SUM(financials[Sales]),
    BLANK()
)

This ensures that sales data is only displayed when a single selection is made.

Step 3: Create a Measure for Text Output

Next, create a measure to show a message when multiple selections are made:

TextOutPut = 
IF(
    [isOneSelected] = 0,
    "Multiple selections not allowed",
    ""
)

Step 4: Add a Card Visual for the Message

  • Insert a Card Visual into your report.
  • Add the TextOutput measure to it.
  • Disable the Category Label in the formatting settings.
  • Customize the background and text color as needed this card will serve as the background for the bar chart.

Bibiano_Geraldo_0-1739431492868.png

Step 5: Overlay the Column Chart on the Card Visual

  • Create a Column or Bar Chart with the same size as the card visual.
  • Set the X-axis to the Country column.
  • Set the Y-axis to the Sales Amount measure.
  • Disable the chart's background (since the card visual will act as the background).

Bibiano_Geraldo_2-1739431872666.png

At this point, the column chart is there, but it looks like nothing has changed. However, the labels are still visible.

Bibiano_Geraldo_3-1739431992104.png

Step 6: Hide the Labels When No Selection Is Made

To hide the labels dynamically:

  1. Select the Column Chart.
  2. Go to Title > Text Color and click on the fx button.
  3. A new window will appear.
  4. In Format Style, choose Rules and base the rule on the isOneSelected measure.
  5. Follow the instructions in the image below (refer to your guide).

Bibiano_Geraldo_4-1739432162833.png                   Bibiano_Geraldo_5-1739432508359.png

Step 7: Hide the X-Axis Title Using the Same Logic

  • Expand the X-axis settings.
  • Click on the fx button for the title color.
  • Apply the same rule as before.

Bibiano_Geraldo_6-1739432792594.png                      Bibiano_Geraldo_5-1739432508359.png

 

Final Result

At this point, the bar chart should disappear completely when multiple selections are made.

Bibiano_Geraldo_7-1739432996884.png

 

Now, just add a slicer, and your final result should look like this:

ezgif-38ef1c02397aaf.gif

 

 

However, as @hnguy71  mentioned, if your goal is simply to force the user to select only one value in the slicer, you can achieve this with a built-in setting:

  1. Select your Slicer.
  2. Go to Slicer Settings.
  3. Enable the Single Select option.

Bibiano_Geraldo_0-1739434966324.png

This approach ensures that the user can only select one value at a time, preventing multiple selections automatically.

v-junyant-msft
Community Support
Community Support

Hi @tecumseh ,

Thanks for hnguy71's reply!
If you mean that when the user makes multiple selections, a pop-up warning will appear, or the original bar chart will be changed to a card chart to display information, then I'm sorry that this is not possible in Power BI.
I can give you a workaround:
Here is my sample data:

vjunyantmsft_0-1739428746442.png

vjunyantmsft_1-1739428752194.png

vjunyantmsft_2-1739428762234.png

Use this DAX to create a measure:

Sum of Value = 
VAR _sum =
CALCULATE(
    SUM('Table'[Value]),
    ALL('Table'),
    'Table'[Channel] <= SELECTEDVALUE(Slicer[Channel]) && 'Table'[ID] = MAX('Table'[ID])
)
RETURN
IF(
    COUNTROWS(VALUES(Slicer[Channel])) > 1, 
    BLANK(), 
    _sum
)

Then create the bar chart (column chart):

vjunyantmsft_3-1739428839019.png

vjunyantmsft_4-1739428845968.png

vjunyantmsft_5-1739428854060.png

Use this DAX to create another measure:

ShowMessage = 
IF(
    ISFILTERED(Slicer[Channel]),
    IF(
        COUNTROWS(VALUES(Slicer[Channel])) > 1, 
        "Please select only one channel to view the bar chart.", 
        BLANK()
    ),
    "Please choose one channel"
)

Then create a Card(New) and put the measure into it:

vjunyantmsft_6-1739428920811.png

vjunyantmsft_7-1739428958157.png

Click Card > Visual > Callout values ​​> Values ​​> enter a space in the field under Show blank as:

vjunyantmsft_8-1739429127936.png

Then go to Cards > Background > Change Transparency to 100%:

vjunyantmsft_9-1739429255332.png

Also close the Border:

vjunyantmsft_10-1739429283655.png


Then overlap the Card (New) and the bar chart:

vjunyantmsft_11-1739429364659.png

And the final output is as below:

vjunyantmsft_12-1739429393107.png

vjunyantmsft_13-1739429401738.png

vjunyantmsft_14-1739429409751.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-junyant-msft 

Works great!

hnguy71
Super User
Super User

Hi @tecumseh ,

Have you thought about disabling multi-select and force select on your users to only have one channel selected at a time?



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Thanks @hnguy71 ,

Users need to be able to select all channels to see company total.
Looks like some great options on this thread to deliver a message to users to "disable" channel detail charts in these instances.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors