Quantcast
Channel: Power Query topics
Viewing all 31342 articles
Browse latest View live

combining data points from multiple fields into one cell for a given connecting ID

$
0
0

Hi - how can I combine a data-point from Table 1 with a data-point from Table 2, in a 3rd Table (e.g. the combined Table).

The data-points are connected thru a unique ID. The result should give me a concatenated version of all information for a given ID in one combining cell, with the combined information being separated by commas within the cell.

Thanks!


Matrix

$
0
0

I have a table:

 

1/31/2019 --- 5.00  --- Washington

1/31/2019 --- 6.00 --- California

1/31/2019 --- 7.00 --- Oregon

1/31/2019 --- 10.00 --- Mexico

3/31/2019 --- 6.00  --- Washington

3/31/2019 --- 7.00 --- California

3/31/2019 --- 8.00 --- Oregon

3/31/2019 --- 9.00 --- Mexico

12/31/2019 --- 8.00  --- Washington

12/31/2019 --- 9.00 --- California

12/31/2019 --- 10.00 --- Oregon

12/31/2019 --- 11.00 --- Mexico

 

And i am trying to get the variance (YearEnd-MonthEnd) and show it in a matrix.  Would you be able to assist?

 

Here is how it should look like:

                                     1/31/2019               12/31/2019

Washington                      3                                 0

California                          3                                 0

Oregon                             3                                 0

Mexico                             3                                  0

 

I created a new query and tried to merge and append the 2 queries but the matrix ends up summarizing the yearend data which is not correct.   Thank you for your help.

IF statment for second table not found

$
0
0

Hi all

I have problem a with IF statement for the second table (its a bit complicated but i will try and explain it)

Capture.PNG

I have 2 tables linked together FIXED MONTH and MONTH 2 is linked together. The slicer Month is table not linked to anyone.
What shuld happen is that i choose a value in the slicer , the left table is checked if slicervalue = MONTH 1 and < FIX MONTH with seems to work as seen on the measure "Check"  "YES"
The MATTE Measure is cheeking "Check" , IF YES then FIX VALUE , witch also works on the left table.
This should now be applied to the right table  and the measure "MATTE" values should be added on right table using the FIX MONTH as month  , and as u can see it works on 2 of the 4 values.I do not understand why the 21 value (MONTH 1 201805 , FIX MONTH 201902) and value 4 (MONTH 1 201805 , FIX MONTH 201904) is not added to the right table. 

There is other strange things if i choose some other slicer value ,  if i choose 201802 on the slicer everything is found on the left table  as it should but not shown on the right table as it should
Capture1.PNG

I hope that i have explained the problem well.
Help really appreciated 

/Thanks

Get data from Web with date in the link

$
0
0

Hello Community.

 

I have a woocommerce website and an Export module installed on the site.

the export module provides 3 links. The first triggers the report creation. The second returns the status...proccessing...complete and the 3rd that downloads the file (Excel).

 

I want to use Power Query to do the job. I.e. trigger, wait, when status is complete to download the file and bring it for transformation.

 

Can you help me on how to do that So Far I see only Get Data -> From Web but only allows one link to be inserted....

error when refreshing

$
0
0

hi

 

i get this error when i try to refresh thw power bi desktop:

 " access to the resource is forbidden"

 

*the power bi file im working on is on the business server so all users can access it

*i get  the data from online share point

*the refresh is working when i do it from my pc but it doesnt work on other user's pc

 

someone know how to solve?

IF statment for second table not found

$
0
0

Hi all

I have problem a with IF statement for the seconed table (its a bit complicatedt but i will try and explain it)

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I have 2 tables linked togather FIXED MONTH and MONTH 2 is linked togater. The slicer Month is table not linked to anyone.

What shuld happen is that i choose a value in the slicer , the left table is checked if slicervalue = MONTH 1 and < then FIX VALUE with seems to work as seen on the measure "Check"  "YES"

The MATTE Measure is cheaking "Check" , IF YES then FIX VALUE , witch also works on the left table.

 

This should now be applied to the right table  and the measuere "MATTE" values should be added on right table using the FIX MONTH as month  , and as u can see it works on 2 of the 4 values.

I do not understand why the 21 value (MONTH 1 201805 , FIX MONTH 201902) and value 4 (MONTH 1 201805 , FIX MONTH 201904) is not added to the right table. 

 

There is other strange things if i choose some other slicer value ,  if i choose 201802 on the slicer everthing is found on the left table  as it should but not shown on the right table as it should,

Capture1.PNG

I hope that i have explained the problem well.

Help really appriciated 

/Thanks

 

Combing Tables

$
0
0

 

 

Hi

 

I have a 500 + excel forms coming in via customers. I need to aggregate the results into one table.  Is this possible in Power Query.

 

An example would be

 

 

 

combined tables.PNG

 

Many thanks

 

Jo.

 

 

Current way to create custom connector

$
0
0

Hi Guys,

 

What is the current way to create/develop custom connectors? Seems PowerQuery SDK does not work with VS 2019. 

Thank you for your answer in advance.

 

Best regards,

 

Jozef


Append records where does not exist on first query

$
0
0

Hi,

 

I have two queries from different sources, I would like to add to the first query from second query where records does not exists on first record.

 

 

Table 1

 

Col1       Col2       Measure

100         XYX       30

234         ZZ           40

 

Table 2

Col1

200

100

 

Desired outcome

Col1       Col2       Measure

100         XYX       30

234         ZZ           40

200

 

can you hep?

Thanks

Append where missing from existing query

$
0
0

Hi,

 

I have two queries from different sources, I would like to add to the first query from second query where records does not exists on first record.

 

 

Table 1

 

Col1       Col2       Measure

100         XYX       30

234         ZZ           40

 

Table 2

Col1

200

100

 

Desired outcome

Col1       Col2       Measure

100         XYX       30

234         ZZ           40

200

 

can you hep?

Thanks

Excel - Get & Transform (Power Query) - transforming "infinity" coming from division by zero

$
0
0

Hi, All

 

I am calculating a %YoY, and I am getting some "infinity". How can I use something in "custom columns" to change infinity instances to say... "0" or just to have control over that?

 

Thanks! Smiley Happy

 

 

1.png

 

Extract data from tab based on similar name

$
0
0

Hello,

 

I am wondering if this is something possible to do.

I receive 30 files per month with two tabs (ie A-aa and B-bb). I need to extract data from tab A-aa. However, some people name it as A-aa, others as A-AA, etc. I am wondering if it is possible to specify the name of the tab so that instead of having Source{[Name="A-aa"]}[Data], I can have Name similar to "aa", for instance.

Distinct Tables

$
0
0

Hi all,

I have been struggling to figure out how to get this to work in PowerQuery [If possible] for the past couple days.
We are trying to create a report based off three columns. (Emplyee Name, Program Name, and Status). An example Excel file screenshot is provided below.

DedupePowerBI.pngExcel.
What we are trying to do is dedupe the table AND check the status of the report. 
Example (I deduped the table based on Employee Name and Program Name): 
PowerBIDeDupe.png

Bob still has two entries. The difference is the Status column. If a user has two different rows with Status of 'Incomplete' and 'Complete', we want to remove the 'Incomplete' row. 
Some users won't have multiple rows. So they may just have the status marked as 'Incomplete', which is fine and we want to keep those. 

I've googled for a couple days and read quite a few articles, wasn't able to figure it out in PowerQuery.
There may be an easier way to this, still learning PowerBi!

Any help would be greatly appreciated!

How to evaluate (get) the name of a column from another query

$
0
0

I have a simple query step:

NextStep = Table.SelectRows(LastStep, each ([Email] <> null))

Now I want the string "Email" to come from another query called "ColumnName". How do I evaluate ColumnName inside the [] to get the word "Email"?

Add n steps for n optional inputs of a function

$
0
0

I have wrote this function that combines Col1, Col2, Col3 from SourceTbl into single Col with a common IDCol:

(SourceTbl as table, IDCol as text, Col as text, Col1 as text, Col2 as text, Col3 as text) =>
let
KeepOnlyCol1 = Table.SelectColumns(SourceTbl,{Col1, IDCol}),
RenameCol1 = Table.RenameColumns(KeepOnlyCol1,{{Col1, Col}}),
KeepOnlyCol2 = Table.SelectColumns(SourceTbl,{Col2, IDCol}),
RenameCol2 = Table.RenameColumns(KeepOnlyCol2,{{Col2, Col}}),
KeepOnlyCol3 = Table.SelectColumns(SourceTbl,{Col3, IDCol}),
RenameCol3 = Table.RenameColumns(KeepOnlyCol3,{{Col3, Col}}),
AppendCols = Table.Combine({RenameCol1, RenameCol2, RenameCol3})
in
AppendCols

How do modify this function so that:

1. It allows for col4, col5, ... coln (as many as the user inputs)

2. With each col, it reproduces the 2 steps:

KeepOnlyColn = Table.SelectColumns(SourceTbl,{Coln, IDCol}),
RenameColn = Table.RenameColumns(KeepOnlyColn,{{Coln, Col}}),

Then add the end append all output tables together:

AppendCols = Table.Combine({RenameCol1, RenameCol2, RenameCol3, ... RenameColn})

Zendesk Data source

$
0
0

I'm having no issues with the Zendesk data source.  It's a fantastic help.  I just need to know if it is using the Zendesk Search API and if the upcoming curbs on that data is going to affect this: 

 

Message from Zendesk attached. 

 

 Part1.jpgPart2.jpgPart3.jpg

JSON API RESULTS columns to rows

$
0
0

Hi

I am calling a JSON API with multiple dimensions and getting results in the following format:

 

{
  "metrics" : [ "FORECAST_ROOMS", "FORECAST_ADR", "FORECAST_REVENUE" ],
  "dimensions" : [ "MARKET_SEGMENT", "TARGET_DATE" ],
  "dimValues" : {
    "MARKET_SEGMENT" : [ "sg3278", "sg3278", "sg3278", "sg3278", "sg3278", "sg3278", "sg3278", "sg3278", "sg3278", "sg3280", "sg3280", "sg3280", "sg3280", "sg3280", "sg3280", "sg3280", "sg3280", "sg3280" ],
    "TARGET_DATE" : [ "2019-06-01", "2019-06-02", "2019-06-03", "2019-06-04", "2019-06-05", "2019-06-06", "2019-06-07", "2019-06-08", "2019-06-09", "2019-06-01", "2019-06-02", "2019-06-03", "2019-06-04", "2019-06-05", "2019-06-06", "2019-06-07", "2019-06-08", "2019-06-09" ]
  },
  "metricValues" : {
    "FORECAST_ROOMS" : [ 161, 153, 147, 156, 150, 155, 160, 161, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
    "FORECAST_ADR" : [ 159.6239751552795, 128.72235294117647, 159.5944217687075, 184.66961538461538, 189.7738, 162.23774193548385, 136.878875, 159.63416149068323, 130.03739884393065, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ],
    "FORECAST_REVENUE" : [ 25699.46, 19694.52, 23460.38, 28808.46, 28466.07, 25146.85, 21900.62, 25701.1, 22496.47, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
  }


I need to get the data into a table similar to the below:

 

Target_Date, Market_Segment, Forecast_Rooms, Forecast_ADR, forecast Revenue,
01/06/2019,Sg_3278, 161, 159.62, 25699.46
01/06/2019,Sg_3280, 0, 0, 0
02/06/2019, Sg_3278, 153, 128.72, 19694.52
02/06/2019, Sg_3280, 0, 0, 0

 

How can I transform the results?

M query help to generate data table with hourly rows in addition to existing table

$
0
0

Hi, 

 

I have got below data as shown in image

data format.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

To get above datatable, i have used below query

 

let
    TodaysDate = Date.From(DateTimeZone.FixedUtcNow()),
    Ranges = {
                {"1D", 
                TodaysDate, 
                TodaysDate, 
                1},
                {"WTD", 
                Date.From(Date.StartOfWeek(TodaysDate)), 
                TodaysDate, 
                2},
                {"MTD", 
                Date.From(Date.StartOfMonth(TodaysDate)), 
                TodaysDate, 
                3},
                {"QTD",
                Date.From(Date.StartOfQuarter(TodaysDate)),
                TodaysDate,
                 4},     
                {"YTD", 
                Date.From(Date.StartOfYear(TodaysDate)), 
                TodaysDate, 
                5},
                {"1W", 
                Date.AddWeeks(TodaysDate,-1) + #duration(1,0,0,0), 
                TodaysDate, 
                6},
                {"4W", 
                Date.AddMonths(TodaysDate,-1) + #duration(1,0,0,0), 
                TodaysDate, 
                7},
                {"LY", 
                Date.AddYears(TodaysDate,-1) + #duration(1,0,0,0), 
                TodaysDate, 
                8}
             },
    GetTables = List.Transform(Ranges, 
            each CreatePeriodTable(_{0}, _{1}, _{2}, _{3})),
    Output = Table.Combine(GetTables)
in
    Output

 

Now the question, i have is i want to generate the file including all the hours starting form the first date in datatable. Similarly, the fist column must state whether it is part of 1D (one day) group, 1W (1 week) group & Month to date (MTD) , quarter to date QTD & year to date (YTD). I am using this to ultimately create a time slicer tile, based on which dashboard user will select the time. Another slicer which is not part of the details which i shared, will actually do the aggregation of the data, e.g day, week, month etc. I managed to get this sorted, but what i missed is Hour part, For single day selection, user want to see the data in hourly, which in current datatable wont possible, 

Please help/guide me generate code in M query where the table contain 24 rows for every date & every group, so that i can club it when required. Hope i managed to explain my problem statement well. TIA

Excel - Get & Transform (Power Query) - Moving average on M Code - Help on how to do it

$
0
0

Hi, All

 

I am trying to do a moving average on Excel Get and Transform, but I can't make it work.

Here is an example of the data.

item, month have a particular value; each item has multiple months.

The goal would  be to use some group by item and calculate moving average (say 3 months) per item.

 

I tried added an index and do {index}-1 thing, but I can't make it to work given the groupby contraint. I am looking for M code solution as I am doing some clean up.

 

Thanks for lending a hand here! Smiley Happy let me know any questions. Thanks!

 

 

 

5.png

Issues in loading Cube and related Dimensions data from API

$
0
0

Hi there,

I am trying to build a custom API connector for Cubes and Dimensions data.

· What I would like to achieve is User can select one or multiple cubes.

· User can select any of the dimension tables as well directly.

· Once user click on load it should load all selected dimension tables and dimension tables related to the selected cubes

· If multiple cubes has same dimension tables then it should load those tables only ones.

I have attached a screenshot of what I have achieved so far. But Issues is that If user selects same table multiple time then those dimension tables are getting loaded multiple time.

Can anyone please guide me how to fix this or achieve in better way.

Regards,

UrmiPage1.png

Viewing all 31342 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>