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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply

If date between two dates get the value by year

HI,

 

I create a measure to check if the date is between 2 dates. 

IF(SELECTEDVALUE(DateTable[Date])>=date_min && SELECTEDVALUE(DateTable[Date])<=date_max,1,0)
When i have the top 3 month of th year equal to 1 the result for the year is equal to 0 because the condition take the result of the last month of the year.
 
MeasureYearColumn A
02021A

 

MeasureYearMonthColumn A
1202101A
1202102A
0202103A

 

How to fix the problem and make the result to 1 for 2021 ?

 

Thank

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Datavizuserpbi 

 

You can try the following methods.
Measure:

Result = 
 Var _count1=COUNTX(FILTER(ALL('Table'),[Year]=SELECTEDVALUE('Table'[Year])&&[Measure]=1&&[Month]<=3),[Measure])
 Return
IF(_count1=3,0,1)

vzhangti_0-1687770713316.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @Datavizuserpbi 

 

You can try the following methods.
Measure:

Result = 
 Var _count1=COUNTX(FILTER(ALL('Table'),[Year]=SELECTEDVALUE('Table'[Year])&&[Measure]=1&&[Month]<=3),[Measure])
 Return
IF(_count1=3,0,1)

vzhangti_0-1687770713316.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

lbendlin
Super User
Super User

Use REMOVEFILTERS against the Month column and return the MAX value.

Mayebe I don't understand but I can't use Max with a measure 

You can when you iterate through it.  Via MAXX for example.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.