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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DAX DATESBETWEEN

I have a list of campaigns, each record has a Start and Finish date associated with it. 

 

I want to be able to get the MINX of Start, the MAXX of Finish, and populate another table with all the dates inbetween the lower and upper range. I am trying to use DATESBETWEEN but am stumbling on the syntax. E.g.

 

Measure = DATESBETWEEN(DateDimension[DateSK],
	MINX(Campaign_Report,Campaign_Report[Start]),
	MAXX(Campaign_Report,Campaign_Report[Finish]))

 

which doesn't return anything (no error either).... Could this be because I am trying to run this in a new table which already has one column populated in it:

 

Table = all(Campaign_Report[UID_CAMPAIGN]
	)

Can anyone give me a nudge in the right direction? Thanks

 

 

 

 

2 ACCEPTED SOLUTIONS
ankitpatira
Community Champion
Community Champion

@Anonymous You should use New Table option under Modelling tab and then use DAX code you've got. From syntax it seems like you're trying to create a measure using DATESBETWEEN which returns table and so it is not working.

View solution in original post

Anonymous
Not applicable

Thanks for your replies - manged to do it with:

 

Table = CALENDAR( minx(Campaign_Report,Campaign_Report[Start]), maxx(Campaign_Report,Campaign_Report[Finish] ))

View solution in original post

4 REPLIES 4
ankitpatira
Community Champion
Community Champion

@Anonymous You should use New Table option under Modelling tab and then use DAX code you've got. From syntax it seems like you're trying to create a measure using DATESBETWEEN which returns table and so it is not working.

Anonymous
Not applicable

Thanks for your replies - manged to do it with:

 

Table = CALENDAR( minx(Campaign_Report,Campaign_Report[Start]), maxx(Campaign_Report,Campaign_Report[Finish] ))

If you think the problem is solved, Can you please mark it as a solution. So the thread can be closed.

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
BhaveshPatel
Community Champion
Community Champion

It seems to me that you are confused with your requirements. Can you please clearly explain what do you mean by 

 

"populate another table with all the dates inbetween the lower and upper range."  Posting Sample data and expected output would be highly appreciated.

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.