- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

# Formatting an Axis based on slicer

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-18-2018 08:15 PM

I'm trying to get something that works a bit like this:

Ideal % slicer setting

Ideal $$ Slicer

Unfortunately, I have:

In order to calculate the actual column values, I have something like this:

Amount = switch(true(),

max('Gross__Margin'[product]) = "$", sum([Sum_gross_profit]),

max('Gross__Margin'[product]) = "%",median([gross_margin]))

Both Sum_gross_profit and gross_margin are formatted as % and $, but this does not carry over to the Y axis.

There's other columns in this graph that are calculated the same way (different colours), but I've not drawn them in the example - but as you can imagine, there are multiple measures using the above code (but they are all very similar numbers).

Is there a way to write DAX that explicitly changes the Y or X axis formatting based on a slicer?

U

Solved! Go to Solution.

Accepted Solutions

## Re: Formatting an Axis based on slicer

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-19-2018 11:30 PM

Hi M_OConnor,

Slicer in power bi can only filter rows, not columns. So your table should be like below:

However, values in [Percentage] column will be text format defaultly so that I'm afraid aggregation function like SUM or MEDIAN can't be used on this column, only function like COUNT can be used.

Regards,

Jimmy Tao

All Replies

## Re: Formatting an Axis based on slicer

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-18-2018 08:29 PM

Please refer the link for answer. It has been solved already.

## Re: Formatting an Axis based on slicer

[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-18-2018 08:40 PM - edited 06-18-2018 09:02 PM

@prihana forgive me if I am misunderstanding, but doesn't this solution rely on the two columns being relatable? My formattable values would need to be able to go into lookup tables (e.g. dates, categories). My two formats depend completely on a sum (already formatted as $) or median (already formatted as %) of many numbers - they are not categorical/relatable. I wouldn't know how to translate that solution to my situation.

## Re: Formatting an Axis based on slicer

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-19-2018 11:30 PM

Hi M_OConnor,

Slicer in power bi can only filter rows, not columns. So your table should be like below:

However, values in [Percentage] column will be text format defaultly so that I'm afraid aggregation function like SUM or MEDIAN can't be used on this column, only function like COUNT can be used.

Regards,

Jimmy Tao