Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
shekhar_shres
Helper II
Helper II

Table.FromList(List.Distinct(Table[ID]), null, {"ID"}) not working for data type that is number

Hi all,

 

I am using following query to extract a Unique data from a column of a table.

 

Table.FromList(List.Distinct(Table[ID]), null, {"ID"})

 

The above query works fine when the column that is being referred to is a text. However, it doesn't work work when the data type is a number. In above case, if the ID column above is of text data type then it works fine but if the data type of the ID is number(int.64), I get following error.

 

shekhar_shres_0-1629420762321.png

 

How do I apply the above query to the column that is int.64? Am i doing something wrong?



Thanks in advance

3 ACCEPTED SOLUTIONS
watkinnc
Super User
Super User

Sometimes M thinks that splitting stuff means that it must be text. Try using Table.FromColumns:

 

= Table.FromColumns({List.Distinct(Table[ID])}, {"ID"})

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

CNENFRNL
Community Champion
Community Champion

Table.FromList(List.Distinct(Table[ID]), Splitter.SplitByNothing(), {"ID"})

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

v-stephen-msft
Community Support
Community Support

Hi @shekhar_shres ,

 

What does your data look like? 

The error message show that it can't convert 8 value, maybe you can check if there is an issue with your 8 value, or try to replace the 8 value with another default value to check if the error is resolved.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
shekhar_shres
Helper II
Helper II

Thank you Both,

Both worked.

v-stephen-msft
Community Support
Community Support

Hi @shekhar_shres ,

 

What does your data look like? 

The error message show that it can't convert 8 value, maybe you can check if there is an issue with your 8 value, or try to replace the 8 value with another default value to check if the error is resolved.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

Table.FromList(List.Distinct(Table[ID]), Splitter.SplitByNothing(), {"ID"})

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

watkinnc
Super User
Super User

Sometimes M thinks that splitting stuff means that it must be text. Try using Table.FromColumns:

 

= Table.FromColumns({List.Distinct(Table[ID])}, {"ID"})

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors