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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
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.