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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
karo
Advocate V
Advocate V

Dynamic Max for X axis for multiple charts

Hi,

 

Can you help me create a measure to dynamicaly customize Max Value for X axis, please? It should cover all scenarios below.

 

1. Max Value for all 3 charts should be set up to 275.

karo_0-1754291050752.png

2. Max Value for all 3 charts should be set up to 75

karo_1-1754291162243.png

 

3. Max Value for all 3 charts should be set up to 275.

karo_2-1754291222094.png

 

1 ACCEPTED SOLUTION

Ahh I didn't know the structure of your data so guessed.

Highest city =
    CALCULATE(
            MAXX(SELECTCOLUMNS('Table', [Category])
                ,MAXX(SELECTCOLUMNS('Table',[City]),[sum city sales] ))
            ,all('Table'[Category]))
 
Change the Inner MAXX to SelectColumn(table,city) that will do the calculation per city instead of per row.

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

9 REPLIES 9
johnt75
Super User
Super User

You can get the max value across all category / city combinations with

Max of all categories =
VAR BaseTable =
    ADDCOLUMNS (
        SUMMARIZE ( ALLSELECTED ( Data ), Data[City], Data[Category] ),
        "@sales", CALCULATE ( SUM ( Data[Sales] ) )
    )
VAR Result =
    MAXX ( BaseTable, [@sales] )
RETURN
    Result
SamWiseOwl
Super User
Super User

Hi @karo 

Use a nested MaximumX function.

So for each Category I want the MaxX of their Cities MaxX.

sum city sales = sum('Table'[Sales]) --Base sales measure
Highest city =
    CALCULATE(
            MAXX(SELECTCOLUMNS('Table', [Category])  --Find the highest categories citites sale
                ,MAXX('Table', [sum city sales])) --find the highest cities sales
            ,all('Table'[Category])) --remove the category filter

File attached.

Edit: I agree the above SmallMultiple solution is more scalable!


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Hi @SamWiseOwl  Thank you for reply. Please correct me if I am wrong, but your idea returns the value for record with highest Sales per City, not the highest Sales per City as a Sum of Sales per City what I need.

 

Hi @karo 

Did you open the attached file?
It appears to work for each given scenario
275 for all regions

SamWiseOwl_0-1754321780836.png


region 1: 75

SamWiseOwl_1-1754321807321.png

Region 2: 275

SamWiseOwl_2-1754321825477.png

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

@SamWiseOwl yes, I opened it. It was really helpful that you attached the file with the solution. However, please split the 275 in the source table into for example 250 and 25 and then you will see what I mean.

Ahh I didn't know the structure of your data so guessed.

Highest city =
    CALCULATE(
            MAXX(SELECTCOLUMNS('Table', [Category])
                ,MAXX(SELECTCOLUMNS('Table',[City]),[sum city sales] ))
            ,all('Table'[Category]))
 
Change the Inner MAXX to SelectColumn(table,city) that will do the calculation per city instead of per row.

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Thank you ❤️

danextian
Super User
Super User

Why not make use of small multiples instead of having multiple visuals?

danextian_0-1754294236941.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextianI tried to use small multiplies, however my goal is to show every category by Sales per City as sorted from highest Sales per City to lowest and small multiples do not allow me to have separate Y Axes.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors