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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RaghdahIsmael
Helper I
Helper I

DatesBetween Function

Hello DAX Community,

 

I'm trying to write 2 meaures using DatesBetween Function as the following :

 

1.  Itemsof2022 = Calculate(Sum('ItemsData'[# of Items]),Datesbetween('Date Dimension'[Date],DATE(2022,01,01),TODAY())).

    The above function implemented successfully as the below visual , though it didn't give me the September data , i have to figure out later.

 

Capture.JPG

 

2.   As for this measure :   Itemsof2021 = Calculate (Sum('ItemsData'[# of Items]),Datesbetween('Date Dimension'[Date],DATE(2021,02,01),DATE(2021,12,31)))  , this one didn't get implemented and it shows me the below error .

 

<ccon> A circular dependency was detected: ItemsData [Itemsof2021], ItemsData [Itemsof2022] , ItemsData [Itemsof2021] . </ccon>

 

I don't understand why it says dependency here , there is no dependency between the above 2 measures [Itemsof2021] and [Itemsof2022] beacuse bascially i'm trying to see the SUM of the column [# of Items] based on each year seperatly ; 2021 and 2022. 

 

can you help please in this regard.

 

thanks 

3 REPLIES 3
RaghdahIsmael
Helper I
Helper I

Hello Everyone,

 

The above issue has not been fixed , i tried all the ways explained in the above but still didn't work !!

 

i tried to fprmulate the below mesaures from :

 

Itemsof2021 =Calculate (Sum('ItemsData'[# of Items]),Datesbetween('Date Dimension'[Date],DATE(2021,02,01),DATE(2021,12,31))

 

- Itemsof2022 = Calculate(Sum('ItemsData'[# of Items]),Datesbetween('Date Dimension'[Date],DATE(2022,01,01),DATE(2022,08,31))

 

Into the following :

 

- Itemsof2022 = Calculate(Sum('ItemsData'[# of Items]),PREVIOUSMONTH('Date Dimension'[Date]))

 

- Itemssof2021 = Calculate (Sum('ItemsData'[# of Items]),SAMEPERIODLASTYEAR(PREVIOUSMONTH('Date Dimension'[Date]))).

 

So basically , i want to replace the job of the filters in the below screenshot by using the sutable DAX, withiout havingme each month changing the filters on the visula manually  🤔

 

And Currently the below visual should present also August and September data on both sides

 

Capture11.JPG

 

thank you in advance,

RaghdahIsmael
Helper I
Helper I

thank you Greg for your reponse , i will try the solutions you listed for me and i will let you know !

Greg_Deckler
Community Champion
Community Champion

@RaghdahIsmael TI functions are bad. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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