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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
water-guy-5
Helper III
Helper III

Find the distinct count of a column within a certain date range

Hello, I am trying to find a distinct count of locations within the first 15 days of a month.

pbcomm2.pngpbcomm3.png

 

Basically the 45 card is filtered by the dates between slicer and the 49 card is set to "Do Not Interact". I would like a measure that calcuates the 45 without needing a slicer. Thanks!

1 ACCEPTED SOLUTION

@water-guy-5 , Try like

 

measure =

var _max1 = minx(allselected('Date'), 'Date'[date]) //selected value or take today

var _max = eomonth(_max,-1) +15

var _min = eomonth(_max,-1) +1

return

calculate(sum(Table[Value]), filter(Table, Table[Date] >=_min && Table[Date]<=_max))

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@water-guy-5 , if you need based on today's date

 

measure =

var _max = today() // or today() -1

var _min = today() -15  //or 16

return

calculate(sum(Table[Value]), filter(Table, Table[Date] >=_min && Table[Date]<=_max))

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

this will be for a kpi dashboard and the entire page will be filtered by relative date = in this month, so i don't need the specific days. more looking for "beginning of month", "beginning of month +15" or something like that.

@water-guy-5 , Try like

 

measure =

var _max1 = minx(allselected('Date'), 'Date'[date]) //selected value or take today

var _max = eomonth(_max,-1) +15

var _min = eomonth(_max,-1) +1

return

calculate(sum(Table[Value]), filter(Table, Table[Date] >=_min && Table[Date]<=_max))

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

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.