Forum Discussion
Deliver Message To User If Too Many Items Selected Else Bar Chart
- Anonymous1 year ago
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: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):
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:
Click Card > Visual > Callout values > Values > enter a space in the field under Show blank as:
Then go to Cards > Background > Change Transparency to 100%:
Also close the Border:
Then overlap the Card (New) and the bar chart:And the final output is as below:
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.
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:
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):
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:
Click Card > Visual > Callout values > Values > enter a space in the field under Show blank as:
Then go to Cards > Background > Change Transparency to 100%:
Also close the Border:
Then overlap the Card (New) and the bar chart:
And the final output is as below:
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.
- tecumseh1 year ago
Resolver III
Thanks Anonymous
Works great!