where put code in power query in exel

ABDELFATTAH MAGHARI 1 Reputation point
2020-11-08T20:01:26.943+00:00

hello
i need help about query i find many codes about power query but i no know where i put to test it in the normal insert module and put into it but power query i have no idea like this code , so could anybody guide me where exactly put the code ,please?
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Date = Table.TransformColumnTypes(Source,{<!-- -->{"Date(DD/MM/YYYY)", type date}, {"Emp Perfomance", type text}}),
stars = Table.AddColumn(Date, "stars", each Text.Select([Emp Perfomance],{"★"})),
emp = Table.AddColumn(stars, "Emp", each Text.Select([Emp Perfomance],{"a".."z","A".."Z"," "})),
Distinct = Table.Distinct(emp),
Group = Table.Group(Distinct, {"Date(DD/MM/YYYY)", "stars"}, {<!-- -->{"Count", each , type table}}),
List = Table.AddColumn(Group, "Custom", each [Count][Emp]),
Extract = Table.TransformColumns(List, {"Custom", each Text.Combine(List.Transform(
, Text.From), " / "), type text}),
RC = Table.RemoveColumns(Extract,{"Count"}),
Pivot = Table.Pivot(RC, List.Distinct(RC[stars]), "stars", "Custom")
in
Pivot

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
38,547 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lz._ 9,006 Reputation points
    2020-11-09T12:22:08.057+00:00

    Hi @ABDELFATTAH MAGHARI

    I would recommend you go through the following links to familiarize yourself with what Power Query is and its user interface:

    To copy/paste a query code in a new query (assuming Excel 2016, 2019 or 365), from Excel:

    • From the Data tab > Get Data > Launch Power Query Editor... (Power Query editor opens)
    • In the Queries pane (on the left side of the screen), right-click > New Query > Other Sources > Blank Query
    • From the Home tab > Advanced Editor > select all > paste your code

    NB: I don't think this will actually help you as if your Excel workbook doesn't have a Table named Table1, with the same column names referenced in the query you posted, nothing will work... :-(

    Hope this helps anyway. Nice day...

    2 people found this answer helpful.
    0 comments No comments

  2. Erin Ding-MSFT 4,461 Reputation points
    2020-11-09T01:53:30.147+00:00

    @ABDELFATTAH MAGHARI

    Tag "office-excel-itpro" focuses on general issues about Excel clients.
    Since your issue is more related to code of Power Query which is out of my scope of support. I would remove the tag “office-excel-itpro”.
    If needed, you may also post your issue on the Power Query forum.

    Thanks for your understanding.

    Regards,
    Erin


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.