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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Please help with creating a measure in DAX

Hello, please, help me calculate a DAX measure, that accumulates all monthly facts on first or last date of month) without splitting by days. Thank you in advance!

 

 

Capture.JPG

 

 

 

 

https://docs.google.com/spreadsheets/d/16aqAMmTDbWlDksY18xXXjlQmtxuRnuFE/edit?usp=sharing&ouid=10565...

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create measure.

First date:

sum of month1 first =
var _sumall=
SUMX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[tn])
var _mindate=
MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date])
return
IF(
    MAX('Table'[Date])= _mindate,_sumall,BLANK())

Last date:

sum of month1 last =
var _sumall=
SUMX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[tn])
var _maxdate=
MAXX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date])
return
IF(
    MAX('Table'[Date])= _maxdate,_sumall,BLANK())

2. Result:

vyangliumsft_0-1666253872069.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create measure.

First date:

sum of month1 first =
var _sumall=
SUMX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[tn])
var _mindate=
MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date])
return
IF(
    MAX('Table'[Date])= _mindate,_sumall,BLANK())

Last date:

sum of month1 last =
var _sumall=
SUMX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[tn])
var _maxdate=
MAXX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date])
return
IF(
    MAX('Table'[Date])= _maxdate,_sumall,BLANK())

2. Result:

vyangliumsft_0-1666253872069.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

Greg_Deckler
Community Champion
Community Champion

@Anonymous Maybe:

Column Sum of Month = 
  VAR __Date = [Date]
  VAR __Fruit = [Fruit]
  VAR __Year = YEAR(__Date)
  VAR __Month = MONTH(__Date)
  VAR __Table = FILTER('Table', YEAR([Date]) = __Year && MONTH([Date]) = __Month && [Fruit] = __Fruit)
  VAR __MinDate = MINX(__Table,[Date])
RETURN
  IF(__Date = __MinDate, SUMX(__Table,[tn]),BLANK())


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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors