Forum Discussion

sdhn's avatar
sdhn
Icon for Responsive Resident rankResponsive Resident
4 years ago
Solved

Merge csv files with new name

Hello All,

 

I am using Power Bi desktop to develop reports. I have merged multiple files onto one file called source.

 All 4 files has same format and structure.

On my new file Source.Name column is displaying as below:

 

 

Source.Name Owner
abc.csvJim
abc.cvsJim
abc.csvJim
efg.csvAike
efg.csvAike
xyz.csvPlus
xyz.csvPlus
mno.csvDivide
mno.csvDivide

  

I am displaying total counts of each file on the Dashboard :

I wrote a measure to dispay row counts for each source.name. 

 

Source.NameSource
abc.csv3
efg.csv2
xyz.csv2
mno.csv2
  

 

I want to display source.name differently. such as ABC Alerts , EFG  Alerts etc 

 

right now it is picking file name as default.  Thanks 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  sdhn ,

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    UPPER( LEFT(MAX('Table'[Source.Name ]),3))&" "&"Alerts"

    2. Result:

    Best Regards,

    Liu Yang

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

6 Replies

  • sdhn , Create a new column in power query or DAX

     

    DAX Column // Power Query use if then else 

    Switch([Source.Name],

    "abc.csv","ABC Alerts" ,

    "efg.csv","EFG Alerts",

    //add other

    "Other"//default value

    )

    • sdhn's avatar
      sdhn
      Icon for Responsive Resident rankResponsive Resident

      I wrote measure as:

       

      Rename Col. = SWITCh([Source],"ABC.csv","ABC Alerts", "EFG.csv","EFG Alerts", //add other
      "Other"//default value
      )
       
      No error.
      But when I checked on measure to display on DB. 
       

       

      • sdhn's avatar
        sdhn
        Icon for Responsive Resident rankResponsive Resident

        Rename Col. = SWITCh([Source],"ABC.csv","ABC Alerts""EFG.csv","EFG Alerts")

         

        still same result 

  • sdhn you should add it is as a column, not a measure:

     

     

    Follow us on LinkedIn and  to our YouTube channel

     

    Learn about conditional formatting at Microsoft Reactor

    My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  sdhn ,

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    UPPER( LEFT(MAX('Table'[Source.Name ]),3))&" "&"Alerts"

    2. Result:

    Best Regards,

    Liu Yang

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