Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Power Query : ignore case in Table.Distinct operations

Power Query is a business intelligence tool available in Excel that allows you to import data from many different sources and then clean, transform and reshape your data as needed.
Power Query Power Query
Power Query

Power Query is a business intelligence tool available in Excel that allows you to import data from many different sources and then clean, transform and reshape your data as needed.

Power Query is case sensitive, sometime Text data have many variations of upper case and lower case characters and should be forced to lowercase or to uppercase to remove duplicates.

Text.lower or Text.upper operations are working only with Text data.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

For data type ANY they will generate Expression.Error if the field contains numeric value for example.

Power Query Expression.error for text operations

The solution is to ignore case for needed field or ignore case in all columns in the Table.distinct.

For example, you have two fields Activity and Activity ID, like below :

Activity | Activity ID
Apple | 1CA11
Apple | 1ca11
Orange | 2dp23
Orange | 2DP23

The result should be like :

Activity | Activity ID
Apple | 1CA11
Orange | 2DP23

To ignore case of just the Activity ID field in Table.Distinct operations, you need to use :

= Table.Distinct(Source,{{“Activity”, Comparer.Ordinal}, {“Activity ID”, Comparer.OrdinalIgnoreCase}} )

To ignore case in all columns in the Table.Distinct :

= Table.Distinct(Source, Comparer.OrdinalIgnoreCase)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading