"sharepoint list" filter with calculated column equal calculated column

Alain Bailly 26 Reputation points
2022-01-10T10:31:37.84+00:00

Dear all,
Thanks to accept me and i wish you the best for this new year.

I have a list with 2 calculated fields and i need to create a view to only display all the lines from WEEK equals to WeekNow

These two columns are calculated columns

163597-sans-titre-9.jpg

Many thanks for your help
Alain

Microsoft 365 and Office SharePoint For business Windows
{count} votes

Accepted answer
  1. Yi Lu_MSFT 17,611 Reputation points
    2022-01-11T07:25:31.233+00:00

    Hi @Alain Bailly
    You could use "Filter by" function to create a view to only display all the lines from WEEK equals to WeekNow.

    First you could add a new calculated column "equal", add a formula to it:

        =IF([WEEK]=[WeekNow],"yes")  
    

    then filter by the column "equal",

    163833-image.png

    163745-image.png

    As a result, you will get the view:

    163778-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Navas Shereef 141 Reputation points
    2022-01-10T16:31:39.423+00:00

    Hi Alain,

    Since you are using SharePoint online, you can achieve this with the help of list view formatting. I created the list with title, Week and WeekNow columns. I used rowformatter in list json view formatter. I tested and it works good. you can use the same JSON and add the column Week and WeekNow as children.
    {
    "$schema":"https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
    "hideSelection":true,
    "hideColumnHeader":true,
    "rowFormatter":{
    "elmType":"div",
    "style": {"display":{
    "operator": "?",
    "operands": [
    {
    "operator": "!=",
    "operands": [
    "[$Week]",
    "[$WeekNow]"
    ]
    },
    "",
    "none"
    ]
    }},
    "attributes":{
    "class":"sp-row-card"
    },
    "children":[
    {
    "elmType":"div",
    "style":{
    "text-align":"left"
    },
    "children":[
    {
    "elmType":"div",
    "attributes":{
    "class":"sp-row-title"
    },
    "txtContent":"[$Title]"
    }
    ]
    }
    ]
    }
    }


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.