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
PowerBiName
New Member

Need help with DAX formula datesbetween

Hi,

I'm new to powerbi dax and any help is appreciated.

What I'm trying to achive and I don't succeed is to create a new column or a measure in a table where the below condition takes place :

if(table.[due date] >=FirstDayofCurrentYear and table.[due date] <= LastDayofCurrentYear , table[amount] , 0) 

What I have done so far : I created a new column named CurrentYearAmount

CurrentYearAmount=if(DATESBETWEEN('table'[due date],[FirstDayofCurrentYear],[LastDayofCurrentYear],'table'[amount],0)) - is it ok?
FirstDayofCurrentYearSold = DATE(YEAR(TODAY()),1,1) is my measure that calculates my start date from current year
LastDayofCurrentYearSold = ??? how do I make that
I'm stuck at this point and I don't know what to do next.
 
Maybe I didn't take the right approach to do this so other ideas are welcome also.
 
Thanks in advance, and sorry for my bad english 😞
Best regards,
 
Bogdan
 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PowerBiName , what are trying to achieve here

 

you can join due date with date table and you can have a year there and filter

 

ot have formula like

measure =
var _min = date(year(today()),1,1)
var _max = date(year(today()),12,31)

return
calculate(countrows(Table) , 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

1 REPLY 1
amitchandak
Super User
Super User

@PowerBiName , what are trying to achieve here

 

you can join due date with date table and you can have a year there and filter

 

ot have formula like

measure =
var _min = date(year(today()),1,1)
var _max = date(year(today()),12,31)

return
calculate(countrows(Table) , 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
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.