I have a column named Birthday and I have created a calculated calumn named BirthGET its formula is: =TEXT(Birthday,"dd/mm").for example a field in Birthday column would be 28/05/1998, now the value in BirthGET would be 28/05 this logic is working nice, but I have a problem.

I have added a content query web part, and I want to filter like this, if todays day and month is equal to BirthGET show that item.

enter image description here

How can I make this?

  • Just to veify, I presume you want the CQWP because you are querying Multiple Lists and/or want to display the results on another Site? If not it is easier to do this in a regular List View (but that would be a View on One List on the Same Site) May 6 '16 at 19:04

It should look something like this:

[Birthday] is equal to DATE(YEAR([Birthday]),MONTH([TODAY],DAY([TODAY]))
  • I am getting the following error: Please specify one of the following [PageFieldValue: (field name)] or [PageQueryString: (query string parameter name)] or an integer value for setting up a dynamic date range for date fields. May 6 '16 at 14:06
  • Another option would be to have calculated fields "BirthdayMonth" and "BirthdayDay" and then specify two filter rules
    – Gintas K
    May 6 '16 at 14:08
  • @NderonHyseni take a look at this: weblogs.asp.net/ricardoperes/…
    – Gintas K
    May 6 '16 at 14:10

You can't use the calculated field BirthGet for this purpose.

You should use a Date field and check if it equals [Today]

  • no this one will not work because I have only dd/mm and [Today] has dd/mm/yy and this is not working May 6 '16 at 13:41
  • Please read answer properly. You can't use calculated field in the filter because it is a Text and not date object May 6 '16 at 13:48
  • Thanks but what should I do in this case? May 6 '16 at 13:50
  • Use the date field. I know you derived BirthGet using a Date field. May 6 '16 at 13:51
  • Could you be more specific please? May 6 '16 at 13:52

You got two options :)

Either using a custom display template or using JSLink

Display Template:

I believe Birthday column has the year so the solution suggested by Patrick won't work! Honestly, Copy one of the existing display templates and apply that logic easily there and only display the desired result (parsing dates in javascript and doing date compare should be easy and lots of resources are out there on the web on how to do that). The solution is going to query the user profile for the Birthday field and do the calculation based on Today's date. If you dont have the user profile birthday property populated or not configured, you can tweak the solution to query the column you already has created.





Create a custom function in the JSLink file that will query the ctx.CurrentItem.Birthday and compare it to current date var currentDate = new Date();( you need to parse the date using JavaScript and do the comparison) like this:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.