问题
Can anybody please help me in getting Total Sale in one bar in Bar Chart visual as show below in picture.
I have calculated total in dataset only just to show the example.
回答1:
Unlike with a table or matrix visual, to get a total on a bar chart you have to do it manually by creating a new table to use as your axis and a new measure to switch between the total and the parts.
See this community post for example.
Here's how you can create a new table to use as your axis:
ChartAxis = UNION ( VALUES ( Sales[City] ), ROW ( "City", "All" ) )
You'll also need a new measure to put on the chart:
SalesByCity =
VAR AxisCity = SELECTEDVALUE ( ChartAxis[City] )
RETURN
IF (
AxisCity = "All",
SUM ( Sales[Sales] ),
CALCULATE ( SUM ( Sales[Sales] ), Sales[City] = AxisCity )
)
来源:https://stackoverflow.com/questions/61784994/how-to-show-total-sale-value-bar-chart-or-any-visual-in-power-bi