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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Urielpc
Frequent Visitor

DAX Calculating Day and Month

Hello,

i have to sum days along with month like this

         day,       sumByDay,   SumByMonth
01/01/2022       10,                    25
02/01/2022       12,                    25
03/01/2022        3 ,                    25
01/02/2022        9 ,                     11
02/02/2022        2 ,                     11

My problem is the filter context
when i use remove all
its give me all dates but i need only for that month
how can i achive that?

Thanks alot

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

A seemly simple solution, but the mechanism under the hood is complex enough.

CNENFRNL_0-1648461928920.png


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

4 REPLIES 4
Urielpc
Frequent Visitor

Thanks CNENFENL

Looks good.

 

Anonymous
Not applicable

Hi @Urielpc ,

 

Please try:

Measure = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),YEAR([Day])=YEAR(MAX('Table'[Day])) && MONTH([Day])=MONTH(MAX('Table'[Day]))))

Eyelyn9_1-1648692725713.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

A seemly simple solution, but the mechanism under the hood is complex enough.

CNENFRNL_0-1648461928920.png


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!

johnt75
Super User
Super User

Make sure that you have a Year Month column on your date table then use

Sum by Month = 
var currentMonth = SELECTEDVALUE( 'Date'[Year Month])
return CALCULATE( [Base measure], REMOVEFILTERS('Date'), 'Date'[Year Month] = currentMonth )

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.