- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Add columns with list of keywords - a cyclic reference was encountered during evaluation
I have two tables:
1) Anamnesis with a long free text column (Diagnosis) for each patient.
2) Conditions of interest(Named ListOfDiagnosis): A table consisting of only those conditions I am interested in.
Having looked at an other solution on this forum I tried the proposed solution on my example
Table.AddColumn(
#"Anamnesis","NewColumn",
each let CurrentText =
[Diagnosis] in Table.SelectRows
(
ListOfDiagnosis, each
Text.Contains(CurrentText, [condition]
)
)
)
However when I execute this code I get: a cyclic reference was encountered during evaluation. I am unable to see this cyclic reference and it is driving me mad(der). 🙂
Hope for some help from the community.
Thanks
Anamnesis
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

🤔 hmmm, it is working on my side. I created mock Anamnesis and ListOfDiagnosis tables (with teh relevant info and structure, although simpler than yours) and it works fine. I do not get any error. Plus looking at the code I really do not see any circular reference problem.
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Anonymous
Can you show the full M code for the query? I don't really see any cyclic reference in what you've written
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for taking time to look into my problem.
But I believe it was the entire code I put in. Please see attached a picture of the code.
NB: The original example listed wrong name for one column. Correct name is in this code [Diagnose].
Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

That is the code for that step only (or so it looks). I mean the code for the full query. Open the advanced editor to copy the whole thing and paste it here. I just ran a quick test and your for that step throws no error. So the error must be somewhere else
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

let
Kilde = Excel.Workbook(File.Contents("C:\Users\bhengse\Documents\Anamnesis.xlsx"), null, true),
Anamnesis_Sheet = Kilde{[Item="Anamnesis",Kind="Sheet"]}[Data],
#"Endret type" = Table.TransformColumnTypes(Anamnesis_Sheet,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}}),
#"Kolonner med nye navn" = Table.RenameColumns(#"Endret type",{{"Column1", "PatientID"}, {"Column2", "SSNNbr"}, {"Column3", "State"}, {"Column4", "Hospital"}, {"Column5", "Physician"}, {"Column6", "Diagnose"}}),
#"Egendefinert lagt til" = Table.AddColumn(#"Kolonner med nye navn", "MyColumn", each Table.AddColumn(#"Anamnesis","NewColumn",
each let CurrentText =
[Diagnose] in Table.SelectRows
(
ListOfDiagnosis, each
Text.Contains(CurrentText, [condition]
)
)
These are the error screens and messges I get when I run the code.
Thanks again.
Appologize for having Norwegian settings on my Power Bi..
))
in
#"Egendefinert lagt til"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

🤔 hmmm, it is working on my side. I created mock Anamnesis and ListOfDiagnosis tables (with teh relevant info and structure, although simpler than yours) and it works fine. I do not get any error. Plus looking at the code I really do not see any circular reference problem.
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for your time.
I am somewhat pleased that it wasn´t a stupid fault on my part.
I think I create a new example from scratch to see if that will work?
Thanks again.

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
Anonymous
| 06-11-2021 12:45 AM | ||
02-16-2024 01:21 AM | |||
08-09-2024 01:56 AM | |||
09-13-2024 06:42 AM | |||
12-05-2023 04:44 AM |
User | Count |
---|---|
27 | |
25 | |
25 | |
13 | |
9 |
User | Count |
---|---|
24 | |
19 | |
16 | |
13 | |
10 |