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

IF function with date greater / smaller 10 (month)

Hi,

 

I have created a formula which is referring to a column with the month from 1 to 12.

So it filters the months which are smaller 9.

That works perfectly but when I enter 10, 11 or 12 the formula

does not work anymore.

Seems like it only counts from 1 to 9 and does not recognize numbers that are greater?

Is this due to the format?

Thank you very much for your help.

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Uygar ,

 

Size comparison logic between text types are different between and number types.

vjaywmsft_0-1670231734567.png

 

Please use numeric type instead.

You could use below formula to create numeric yearmonth column.

yearmonth = year([date])*100+month([date])

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

5 REPLIES 5
v-jayw-msft
Community Support
Community Support

Hi @Uygar ,

 

Size comparison logic between text types are different between and number types.

vjaywmsft_0-1670231734567.png

 

Please use numeric type instead.

You could use below formula to create numeric yearmonth column.

yearmonth = year([date])*100+month([date])

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Uygar
New Member

I can share the formula that works:

 

IF('Sales'[Month and Year]<"8 - 2022", round(LOOKUPVALUE('currency'[rate per EUR], 'currency'[Date], 'Sales'[Month and Year])*'Sales'[Amount],2),

round(LOOKUPVALUE('currency'[rate per EUR], 'currency'[Type and Date], "Planning 2023")*'Sales'[Amount],2)

 

So this works, but when I enter <"10 - 2022" instead of <"8 - 2022" it does not work anymore, does not show the correct amount for the month.

 

Thank you

somehow it does not recognize it when the filter is greater "9 - 2022"..

NikhilChenna
Continued Contributor
Continued Contributor

Hi @Uygar ,

 

Can you please share a sample data set with the formula it will be easy to understand.

 

Regards,

Nikhil Chenna

FreemanZ
Super User
Super User

can you paste your formula and also some sample data?

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.