cancel
Showing results for
Did you mean:
Frequent Visitor

## Display percentage of filtered total in a line chart

Hi,

I'm trying to display the % of total sales for each groups name over a three year period but only where the country = X.

I can do this in a matrix using the percentage of column total function but am unable to display this in a line chart. Any suggestions how I might do this?

 Group Name Year Sales Country A 2015 X A 2016 X A 2017 X B 2015 y B 2016 y B 2017 y C 2015 X C 2016 X C 2017 X D 2015 X D 2016 X D 2017 X E 2015 y E 2016 y E 2017 y

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Display percentage of filtered total in a line chart

@arp

Sorry. I seem to have made a mistake in my previous post. Try this:

Measure =
DIVIDE (
SUM ( Table[Sales] ),
CALCULATE ( SUM(Table[Sales]), ALL ( Table1[Group Name] ) )
)

Code formatted with

7 REPLIES 7
Super User

## Re: Display percentage of filtered total in a line chart

Hi @arp

I think you can do the same in a line chart. Place the [Group Name] in the x-axis and Sales in values and choose Show as Percentage.

Set [Country in a slicer to restrict the calculation to 'X'

Frequent Visitor

## Re: Display percentage of filtered total in a line chart

Hi,

This hasn't worked for me. The group names have filtered to those in country X but the percentage values are still being calculating on total sales rather than just sales in country X...

Super User

## Re: Display percentage of filtered total in a line chart

@arp

OK, then let's try with a measure in the values of the chart:

Measure =
DIVIDE (
SUM ( Table[Sales] ),
CALCULATE ( Table[Sales], ALL ( Table1[Group Name] ) )
)

and still with [Country] in the slicer to select "X" (or any other)

Community Support Team

## Re: Display percentage of filtered total in a line chart

Hi @arp,

By my tests, I'm afraid the option Percent of column total is only for matrix visual currently in Power BI as it has Column Field.

For other charts, it only has Percent of grand total.

For your requirement, you'd better create a measure like AlB suggest to achieve that.

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

## Re: Display percentage of filtered total in a line chart

Thanks both for the replies.

I'm trying to set up the measure as suggested but I'm getting an error message saying that a single value for the sales column in the relevant table cannot be determined?

Super User

## Re: Display percentage of filtered total in a line chart

@arp

Sorry. I seem to have made a mistake in my previous post. Try this:

Measure =
DIVIDE (
SUM ( Table[Sales] ),
CALCULATE ( SUM(Table[Sales]), ALL ( Table1[Group Name] ) )
)

Code formatted with

Highlighted
Frequent Visitor

## Re: Display percentage of filtered total in a line chart

@AlB

That's better! Thank you for your help