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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
M_OConnor
Helper I
Helper I

Formatting an Axis based on slicer

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

 

Ideal % slicer setting

 

correctgraph.PNG

 

Ideal $$ Slicer

dollargraph.PNG

Unfortunately, I have:

actualdollar.PNGwronggraph.PNG

 

 

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

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

Hi M_OConnor,

 

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

捕获.PNG 

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

View solution in original post

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

Hi M_OConnor,

 

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

捕获.PNG 

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

prihana
Helper V
Helper V

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

@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. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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