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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
irnm8dn
Post Prodigy
Post Prodigy

Scientific Format in Dataset .csv - PLEASE HELP!

I have a source file that is in a .csv format.  One of the columns is presenting data in a scientific format.  Regardless of trying to change format in the .csv, Power BI wants to convert the records.  Additionally, the .csv once saved and reopened, also reverts.

 

Is there a way in Power BI to interpret this columns as Text or Number and have the file interpret the values properly as they come from the source?

 

Thanks.

 

BTW, have tried all the recommended tricks in both Excel and in the community.

1 ACCEPTED SOLUTION

Perhaps

 

let
    Source = Csv.Document(File.Contents("C:\temp\powerbi\science.csv"),[Delimiter=",", Columns=1, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Column", type text}})
in
    #"Changed Type"

?

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

What does your data look like, something like:

 

1e+13

 

?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

 

Example from the .csv is:

 

1.38206E+11
1.38206E+11
1.38206E+11
1.38233E+11

 

Upon import in Power BI it looks like:

 

Capture.JPG

 

Additionally, the problem is that the conversion to Scientific and then ultimately the Power BI interpretation is changing the values received from the source.  (And in some cases taking these unique values and making them look like dupes...)

 

Thanks.

 

Perhaps

 

let
    Source = Csv.Document(File.Contents("C:\temp\powerbi\science.csv"),[Delimiter=",", Columns=1, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Column", type text}})
in
    #"Changed Type"

?

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

 

Can you step me through how to do this.  I am still a bit of a newb.

 

Where, how, etc. the statement below (or one like it) neeeds to be applied would help a great deal.

 

Thanks.

So, what I did was to replace the default Change Type step in the query. So, I selected that step in the query editor and then I right-click the column and change the type to text and it asks if I want to replace the current step, I say yes.

 

Could be more specific if you could paste your query code from the Advanced Editor.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

 

Thanks, this seemed to move me incrementally forward.  What I don't understand is once the relationship is made, why my table is not showing me a correct output, by the desired dimension?

 

The left most column should be a list of Customers.

 

Capture.JPG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.