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.
Hello everyone,
I am new in Power BI and I would like to request your help.
I have a dataset with football players and their current value (cost).
My problem is that the VALUE column has data in the following format (just few examples):
€9,5M
€600K
€10K
The dataset looks something like this (with far more columns):
Name | Club | Value |
Neymar Jr | Paris Saint-Germain | €118.5M |
D. Bernhardt | Vfr Aalen | €600K |
R. Zapata | Independiente Santa Fe | €70K |
P. Glykos | PAOK | €1.4M |
The type of data is string and currently I can't do any report whit it.
So I am looking into solution which would:
1) Remove € and M and transform the remaining value into float if it's millions (€9,5M)
2) Remove € and K, transform the remaining value into float and express it in millions (if it's in thousands, K). So if it's 600K it should become 0,6. Or if it's 10K then 0,010.
Thank you in advandce for your help!
Solved! Go to Solution.
Hi @Neetsmlam
Please see the attached File with a solution included.
Hi @Neetsmlam !!
Try to create the following column:
Columna = IF(
RIGHT(Tabla[Value];1)="K";
MID(Tabla[Value];2;LEN(Tabla[Value])-2) * 1000;
IF(RIGHT(Tabla[Value];1)="M";
MID(Tabla[Value];2;LEN(Tabla[Value])-2) * 1000000;
MID(Tabla[Value];2;LEN(Tabla[Value])-2) * 1))
And then, change the column format to monetary in €.
The result:
Hi @Neetsmlam
Please see the attached File with a solution included.
Thank you very much @Mariusz !
It works!
Could you please explain your code (if it doesn't bother you)
Do the follow step to achieve your goal.
To remove Currency Symbol:
Go to Query Editor --> Select your Column --> Right click on that column --> Select 'Split column by Position' --> Enter 1 in position --> hit ok.
Please don't forget to hit THUMBS UP and Accept this as a solution if it helps you!
Hi @Mariusz ,
Thank you for you response.
The dataset looks something like this (with far more columns):
Name | Club | Value |
Neymar Jr | Paris Saint-Germain | €118.5M |
D. Bernhardt | Vfr Aalen | €600K |
R. Zapata | Independiente Santa Fe | €70K |
P. Glykos | PAOK | €1.4M |
Hello @Neetsmlam ,
use a Tansform.Columns to achieve this. Here an example
let
Source = #table
(
{"Name","Club","Value"},
{
{"Neymar Jr","Paris Saint-Germain","€118.5M"}, {"D. Bernhardt","Vfr Aalen","€600K"}, {"R. Zapata","Independiente Santa Fe","€70K"}, {"P. Glykos","PAOK","€1.4M"}
}
),
Tranform = Table.TransformColumns
(
Source,
{
{
"Value",
(transform)=>
let
DeleteEuro = Text.Replace(transform, "€", ""),
Transform = if Text.End(DeleteEuro,1)="M" then
Number.From(Text.Replace(DeleteEuro, "M",""),"en-US")*1000000
else if Text.End(DeleteEuro,1)="K" then
Number.From(Text.Replace(DeleteEuro, "K",""),"en-US")*1000 else null
in
Transform
, type number
}
}
)
in
Tranform
Copy paste this code to the advanced editor to see how the solution works. Copy a part of this to your query to apply it. Or I could create a function out of it, if you want
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
77 | |
68 | |
54 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |