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
CBloem
New Member

Dynamic axis Report Builder Power BI

Hi everybody! Can you help me out with dynamic axis in Power BI report builder?

 

For a report I am building in Power BI report builder, I am creating bar charts and column charts.

As you know, charts are dynamic, which causes the issue that sometimes there is not enough room to place the datalabels outside. To solve this matter, I want to create a dynamic axis.

 

The below graph is an example of what I want to achieve.

For this graph, everything worked fine.
I was able to get the result by the following expression for the MAX value: for my y-axis:

 

=Max(Count(Fields!Matchkey.Value))*1.1

  CBloem_0-1686214242741.pngCBloem_1-1686214250476.png

I now want to achieve the same result for a bar chart:

CBloem_2-1686214389038.png

But, if I use the same formula to determine the max value for my x-axis, I get the following result:

CBloem_3-1686214434141.png

I have two parameters in my report. After selecting the parameter values and running the report, the total Matchkeys in this particular selection is 381.

However, it should pick in this case the 117 (= the max value for this graph) and multiply this with 1.1 to create a margin so that the labels fit next to the bar, but it is picking up the total Matchkeys, instead of the Max matchkey count for this selection.

 

Does anyone know how to solve this matter?

Formula's I have tried already, are:

=MAX(Fields!Matchkey.Value)*1.1

=MAX(Fields!Matchkey.Value)*2

=Count(Fields!Matchkey.Value)

=MAX(Count(Fields!Matchkey.Value))

=MAX(Count(Fields!Matchkey.Value)) *1.1

 

ChatGPT is not helpful unfortunately.

As a suggestion it's giving me to create a calculated field that calculates the max value, and then use that in my expression to determine the max value.

I could not do that as it gives me the error that you cannot use an aggregate function in a calculated field (COUNT and MAX). 

It appears the report processes the axes for bar charts differently then for column charts.

 

 

Does anyone know what I should do? Help is very much appreciated!

1 REPLY 1
CBloem
New Member

Hello everyone. 
So I thought my solution looked very promising. However, I noticed it is still not working properly because my dataset has large differences in it, and when I tested it further I noticed that it is also picking the max matchkey count for the column chart, I was just very lucky with the example that it worked out. 

So, any help is welcome!! 

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.