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! Request now

Reply
BIBRO
Frequent Visitor

Filter to last day of month or max day of table

I am trying to get the distinctcount of id's where the date = last day of the month or current day. The formula looks like this.

Calculate(DISTINCTCOUNT(TABLE[ID],FILTER(TABLE,TABLE[DATE] IN {VALUES(DATE_TBL[LAST_DAY_OF_MONTH])} || TABLE[DATE] = MAX(TABLE[DATE])

 

I get the expected results when it's just Last day of Month. When I include || Max(Table[Date}) I don't get the results that I want.

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @BIBRO ,

 

Based on your description, I have created a simple sample;

vjianbolimsft_1-1662452297123.png

 

Please try:

Measure = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Date]=MAX('Table'[Date])||[Date]=EOMONTH([Date],0)))

Final output:

vjianbolimsft_2-1662452360084.png

Best Regards,

Jianbo Li

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
v-jianboli-msft
Community Support
Community Support

Hi @BIBRO ,

 

Based on your description, I have created a simple sample;

vjianbolimsft_1-1662452297123.png

 

Please try:

Measure = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Date]=MAX('Table'[Date])||[Date]=EOMONTH([Date],0)))

Final output:

vjianbolimsft_2-1662452360084.png

Best Regards,

Jianbo Li

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

amitchandak
Super User
Super User

@BIBRO ,

 

Sumx(Values(Table[Month Year]) , calculate(lastnonblankvalues( Table[Date], DISTINCTCOUNT(TABLE[ID]) ) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.