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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DarrenLau
Advocate I
Advocate I

Help with calculating Min/Max values for Chart

Hi,

 

I am very puzzled by this behaviour and want to seek community members advise. I am trying to determine Min/Max values of a chart using the DAX formula below:-

 

 

MaxOppWonValue_MthName = 
MAXX (
    ALLSELECTED ( 'Calendar'[Mth] ),
    [OppWonValue]
)

MinOppWonValue_MthName = 
MINX (
    ALLSELECTED ( 'Calendar'[Mth] ),
    [OppWonValue]
)

 

 

 

where [OppWonValue] is

 

 

OppWonValue = 
CALCULATE (
    SUM ( 'Opportunities'[Revenue] ),
    'Opportunities'[Status] = "Won"
)

 

 

 

The issue is when I use the Mth column in Calendar table (eg Jan, Feb, Mar, Apr ...) as the common axis on the chart, the charts do not show the correct Min/Max values.

 

DarrenLau_0-1644366993891.png

 

 

However, if I change the DAX formulas to MonthNumberOfYear and the chart axis to the MonthNumberOfYear, the calculations work.

 

 

MaxOppWonValue_MthNumber = 
MAXX (
    ALLSELECTED ( 'Calendar'[MonthNumberOfCalendarYear] ),
    [OppWonValue]
)

MinOppWonValue_MthNumber = 
MINX (
    ALLSELECTED ( 'Calendar'[MonthNumberOfCalendarYear] ),
    [OppWonValue]
)

 

 

 

DarrenLau_1-1644367037868.png

 

What am I doing wrong or missing here?

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

An very hidden pitfall of "Sort by Column" setting. You may refer to this article,

Side effects of the Sort By Column setting in DAX - SQLBI

 

MinOppWonValue_MthName = 
MINX (
    ALLSELECTED ( 'Calendar'[Mth] ),
    CALCULATE([OppWonValue], ALL('Calendar'[MonthNumberOfCalendarYear]))
)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
DarrenLau
Advocate I
Advocate I

Wow, thanks for the quick response. I remember reading that particular article and making a mental note for future (which obviously didn't help in this instance hahaha).

 

End result that I was trying to achieve:

DarrenLau_0-1644376601615.png

 

CNENFRNL
Community Champion
Community Champion

An very hidden pitfall of "Sort by Column" setting. You may refer to this article,

Side effects of the Sort By Column setting in DAX - SQLBI

 

MinOppWonValue_MthName = 
MINX (
    ALLSELECTED ( 'Calendar'[Mth] ),
    CALCULATE([OppWonValue], ALL('Calendar'[MonthNumberOfCalendarYear]))
)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.