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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
gamer_77768
Regular Visitor

MAX DAX Function giving incorrect sum

Hi,

 

I have a requirement where I have to multiply an amount by 5 if the current month is the first month of quarter, else multiply by 4. Ex: if the month is January(1), April(4), July(7), October(10) then multiply by 5, else multiply by 4 for the rest of the months.

 

I have written below DAX formula for it:

gamer_77768_0-1712424808307.png

 

This gives proper result in most cases where all the months are either start of the month (any combination of 1, 4, 7 ,10) or the other months (any combination of 2, 3, 5, 6, 8, 9, 11, 12).

But gives incorrect result when the months selected are a combination of start of quarter months and other months (ex: 10 and 11).

 

Below is the snapshot of the result:

gamer_77768_1-1712424971912.png

 

This example should sum to 8,930,815.3 but currently it shows 7,948,491.08.

 

Kindly advise what can be done to achieve the correct results, or if anything is not right in the applied DAX formula.

 

Thanks in advance!

1 ACCEPTED SOLUTION
BrunoTalini
Frequent Visitor

Hello! I would try the following:

RETURN

SUMX( 'Calendar Master',
IF( MAX( 'Calendar Master'[Fiscal month num])IN(1,4,7,10), DIVWEEKS*5, DIVWEEKS*4)
)

 

If that doesn't work, I'd try checking the filters applied to the sheets and visuals.
Best regards!

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@gamer_77768 First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
BrunoTalini
Frequent Visitor

Hello! I would try the following:

RETURN

SUMX( 'Calendar Master',
IF( MAX( 'Calendar Master'[Fiscal month num])IN(1,4,7,10), DIVWEEKS*5, DIVWEEKS*4)
)

 

If that doesn't work, I'd try checking the filters applied to the sheets and visuals.
Best regards!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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