cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## 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.

 Measure Year Column A 0 2021 A

 Measure Year Month Column A 1 2021 01 A 1 2021 02 A 0 2021 03 A

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

Thank

1 ACCEPTED SOLUTION
Community Support

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)``````

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.

4 REPLIES 4
Community Support

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)``````

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.

Super User

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

Helper I

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

Super User

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.