Se non sai come risolvere l'errore DataFormat.Error: We could not convert to a number, ecco una guida che ti aiuterà.
A questo proposito, leggi il post per risolvere il problema 'DataFormat'. Impossibile convertire in formato numerico. Lavorare in Power Query all'interno di Excel o Power BI dovrebbe semplificare l'analisi dei dati e la creazione di report. Tuttavia, molti dei suoi utenti affrontano il fastidio di problemi di conversione del tipo di dati, soprattutto quando i formati non sono coerenti.
I problemi di interpretazione dei dati da parte di Power Query dovuti a delimitatori incompatibili, formati di dati diversi o impostazioni regionali errate genereranno il seguente messaggio di errore di conversione:
Formato per i dati. Non siamo riusciti a convertire nel formato numerico. [Dettagli errore]:
In questo articolo ti illustreremo le radici del problema e i rimedi efficaci per questo tipo di errori.
Formattare correttamente i datiConversione in numero non riuscita
DataFormat. La correzione degli errori richiede Ecco alcune delle poche tecniche che abbiamo provato quando abbiamo gestito i dati in Power Query, Excel o Power BI ma non siamo riusciti a convertirli in numeri:
Rimuovi il "Tipo di modifica" compilato automaticamente
Rimuovi valori non numerici
Pulisci e standardizza i tuoi dati prima di cambiarne il tipo.
Imposta manualmente le impostazioni locali e i delimitatori
Separare correttamente migliaia e decimali
Entriamo più nel dettaglio.
1. Rimuovere il passaggio "Modifica tipo" che avviene per impostazione predefinita
Dopo l'importazione dei dati, Power Query aggiunge spesso un passaggio "Change Type" per provare a livello di programmazione ad applicare i tipi di dati di colonna in base alle prime 1.000 righe. A volte questo può essere problematico se i dati contengono tipi che si scontrano tra loro, ad esempio, testo e valori interi in una colonna. "Impossibile convertire in Number".
Per farlo, nella scheda Dati in Excel, clicca sul pulsante Ottieni dati. In Power BI, cliccando su Trasforma dati si aprirà l'opzione Avvia editor di Power Query.
Il riquadro Applied Steps, in Power Query Editor, si trova sul lato destro della finestra. Se il passaggio 'Changed Type' è già presente, Power Query ha già assegnato automaticamente i tipi di dati per te. Per eliminare un passaggio, fai clic sulla X che apparirà accanto ad esso. Power Query smetterà automaticamente di provare a convertire anche i tipi di dati.
Dopo aver rimosso il passaggio "Tipo modificato", verificare che a ciascuna colonna sia stato assegnato il tipo di dati corretto.
2. Rimuovere i valori non numerici
This may happen when text and numeric values are in the same column, such as "ABC 123," because Power Query would try to make all of those into a number. Here is a couple of things you can try to rectify this:
Change the data type for the column to 'Text', use Replace Values to correct the faulty value, and then revert back to 'Decimal Number'.
You can also achieve this using the Split Column feature based on the delimiter. Then, change the data type of one column to 'Text' and the other one to 'Number'.
You may clear entries that include invalid or non-numeric values before you can change the data type for that column to Number.
Once you filter out entries that are not numbers, you can safely change the data type for the original column to Number.
3. Clean and standardize data before type conversion.
Sometimes, when you copy data from the internet, Power Query is confused when it tries to convert or combine columns because there are non-breaking spaces, or symbols like '&' or ',' in the data.
To remove these, once the Transform menu is clicked, either the CLEAN or TRIM function can be selected. One removes extra spaces in the text, leaving only one space between words; the other removes all non-printable characters. This latter one is particularly useful when cleaning data brought into Power BI from elsewhere since it identifies hidden characters which might not be otherwise discovered.
Reset the data type of the column once these functions are applied.
4. Delimiters and locale can be set manually.
If regional settings exist in your data, it's very important to ensure that the correct delimiter is used along with the correct locale in Power Query. Suppose you work with European data where the comma is the decimal separator. You would have to change Power Query to the source locale manually at File>Options>Query Options>Regional Settings.
If it is a single column, you will be able to change the data type correctly using the appropriate regional settings by navigating to Change Type Using Locale.
When you import CSV files, you also have to manually change the delimiters to comma or semicolon depending on whether your data uses them.
5. correct separators for decimals and thousands
Finally, use the Replace Values to replace the faulty separator if the Power Query is not converting the numbers because the decimal points and thousand separators are mismatched. In this case, for European data, replace '.' with '.' to convert it to what is expected.
Indeed, knowing some of these most frequent roots of the "DataFormat.Error" will enable you to debug and solve this problem fast and easily in your applications.
Ti guiderò in questo documentario su come abilitare la ricarica USB-C su un laptop in Windows 11
In questo documentario ti insegnerò come installare e configurare i servizi di distribuzione Windows
Ti spiegherò come installare e configurare il collegamento in Windows Server
Ti guiderò su come risolvere il codice di errore Outlook 3399811147, tag di errore 7ita9
Se ti stai chiedendo come disattivare la funzione Sovrascritturanel Blocco note in Windows 11, ecco una guida che ti aiuterà.
Preparati a scoprire come risolvere il problema Windows: ilcomputer non si avvia dopo aver abilitato XMP nel BIOS, perché eccotutto ciò di cui hai bisogno.
Qui ti mostriamo come utilizzare in modo semplice il Visualizzatore eventi in Windows 11.
Preparati a scoprire come risolvere il problema dell'assenza diInternet dopo aver impostato un IP statico su Windows 11, perché oggi tifaremo sapere di cosa hai bisogno.