Forum Discussion
Error if no match on join
Problem 1 - If there are any new Cost Centers that show up in the main table's Excel file that are not in the lookup table, I want the dashboard to throw an error
When the correspoding values don't exist in Lookup table, all values from Lookup table will be null.
Then you can check for the existence of the null in any field of your choice (choose a field which can't be null) and mark error in the custom column.
Note, you can also check just before expanding your result by Table.IsEmpty as well.
if Table.IsEmpty([Column] then "Fail" else "Pass"
2. if there's a way to also throw an error if a table has a particular column with duplicate values
You will need to group the table and take count and do a self merge to take count in a separate column.
Create a custom column to say if count > 1, then duplicate.
Hence, in a custom column you can say
= if [Column]=null then "Fail" else "Pass"
Edit - Another approach is to use following
if List.Count(List.PositionOf(Source[Letters],[Letters],Occurrence.All))>1 then "Duplicate" else "Not Duplicate"
All these techniques I have demonstrated in following file - https://1drv.ms/x/s!Akd5y6ruJhvhuSOtm_KabLBuzL7F?e=34HFkh
- Anonymous4 years agoNot applicable
Hi Vijay, how do I "mark errors" in the custom column? Tried to google but couldn't find the syntax for specifying errors.
Here are my applied steps in the query currently:
And here is my code in the Advanced Editor:
I also don't understand your "other approach" - where exactly would I be putting this line of code with the if statement?