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

Data access issue

$
0
0

Im trying to access a web location through power query/power bi. I have a url and the first time I put it in it asked me the access method, ie windows account or organization account. Unfortunately I put in the wrong method and it is denying me access. Now when I try again with the same url it does not ask me the access method it just goes straight to access denied. How do I get it to ask that question again so I can change the method. Is there some sort of cache that needs to be cleared?


Applied Steps and Re-quering Data Source

$
0
0

Using Power Query, each time you change a field type or expand a column does the step result in the data source being re-queried?

 

Steps:
connect to a data source

filter rows

change column type

expand column

 

Would the steps outlined above result in one query back to the data source or multiple?

Extracting data from Time Log extension in Azure DevOps.

$
0
0

I am using the Time Log extension to capture times within stories and tasks in Azure DevOps.

I am extracting the ADO information into power BI. I am manually dumping the Time Log information from the Time Log Summary into a csv, store it in sharepoint and then it will load into power bi.

 

Being "constructively lazy", i would like to know if it is possible (and how) to load into power bi from the azure extension area directly os that it will update during the scheduled refreshes. 

 

"https://{organisation).extmgmt.visualstudio.com/_apis/ExtensionManagement/InstalledExtensions/timelog/time-logging-extension/Data/Scopes/Default/Current/Collections/TimeLogData/Documents/" 

The link when i look through chrome seems to come back immediately with all the data. I cant figure out how to bring that query into my power query to get the same data (just beggining the journey into the wonders of Power BI).

 

Reduce table in table to columns

$
0
0

I use Power Query for Microsoft Excel. I get my data from an API. I transform it and group it. Afterwards, I receive a table which has table entries. I don't need tables there, I need the first column of the table in the table. 

The first column of the column is only the name of the column, so I need to remove the first column.

I tried to use the "Extend columns" functionality (symbol with the two arrows in the header). But then I get the two columns in the first column. Doing the same in the second column, brings up lines of the first column multiplied with number of lines of the second columns. 

I just want to see the columns in a table withe original number of results.

How can I achieve this?

 

table.png

 

Expand the column

 

table2.png

table3.png

 

My code after the API request. This request is not provided.

 

result = Quelle[result], rowsList = result[rowsList], #"In Tabelle konvertiert" = Table.FromList(rowsList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Erweiterte Column1" = Table.ExpandListColumn(#"In Tabelle konvertiert", "Column1"), #"Erweiterte Column2" = Table.ExpandRecordColumn(#"Erweiterte Column1", "Column1", {"value", "columnName"}, {"Column1.value", "Column1.columnName"}), #"Neu angeordnete Spalten" = Table.ReorderColumns(#"Erweiterte Column2",{"Column1.columnName", "Column1.value"}), #"Gruppierte Zeilen" = Table.Group(#"Neu angeordnete Spalten", {"Column1.columnName"}, {{"Anzahl", each _, type table [Column1.columnName=nullable text, Column1.value=nullable text]}}), #"Transponierte Tabelle2" = Table.Transpose(#"Gruppierte Zeilen"), #"Höher gestufte Header2" = Table.PromoteHeaders(#"Transponierte Tabelle2", [PromoteAllScalars=true]), #"Erweiterte 1" = Table.ExpandTableColumn(#"Höher gestufte Header2", "11", {"Column1.value"}, {"11.Column1.value"}) in #"Erweiterte 1"

 

DAX formula for MTA

$
0
0

 Hi there, I have a Sharepoint list (Infopath form) in which you can insert milestones, their start date, their planned end date and their new end date (if its different from the planned end date). After all I want to create an MTA with this data.  So what I want power query actually to do is, set the data of the new end date column to a new "report-column". Like when it is 1. October 2020 I want the data of the new end date column set to the column "01.10.2020" and so on. Is this possible? Thank you very much!! Jasmin

Salesforce Object Connector - Nested query

$
0
0

Hi.

I have a problem receiving the data that I want from the object connector. Through the Salesforce database our developer is able to query the data using a "nested query":

Nexans_0-1600246257275.jpeg

In Power BI I have enabled "Include relationship columns" when I load ClassMembership__Feed to get the column; however, when I try to expand FeedTrackedChanges I get:

Nexans_1-1600246530363.png

The M-code looks like this (on a text-expand)

 

 

let Source = Salesforce.Data("https://login.salesforce.com/", [CreateNavigationProperties=true]), ClassMembership__Feed = Source{[Name="ClassMembership__Feed"]}[Data], #"Expanded FeedTrackedChanges" = Table.ExpandTableColumn(ClassMembership__Feed, "FeedTrackedChanges", {"Id", "FeedItemId", "FieldName", "OldValue", "NewValue"}, {"FeedTrackedChanges.Id", "FeedTrackedChanges.FeedItemId", "FeedTrackedChanges.FieldName", "FeedTrackedChanges.OldValue", "FeedTrackedChanges.NewValue"}) in #"Expanded FeedTrackedChanges"

 

 

 

How can I replicate the resonse that the developer is getting from Salesforce direct query?

If it's monday then display last friday date

$
0
0

Hello, I'm trying to create a query where if it's a monday then set the date to the last friday else previous day. So for example for this week monday was the 14th so I would like Todaycode to show 20200911 instead of 20200913 since it usually just takes the previous day.
I've tried to use If Date.Dayofweek(#"Inserted Merged Column", Column1 = 1) then [custom.1] -3 else #"Inserted Merged Column"{0}[Todaycode] without success. Screenshot 2020-09-16 111557.png

 

 

 

let Source = DateTime.Date(DateTime.LocalNow()), #"Converted to Table" = #table(1, {{Source}}), #"Inserted Year" = Table.AddColumn(#"Converted to Table", "Year", each Date.Year([Column1]), Int64.Type), #"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month", each Date.Month([Column1]), Int64.Type), #"Inserted Day" = Table.AddColumn(#"Inserted Month", "Day", each Date.Day([Column1])-1, Int64.Type), #"Changed Type1" = Table.TransformColumnTypes(#"Inserted Day",{{"Month", type text}, {"Day", type text}, {"Year", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Text.PadStart([Month],2,"0")), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Text.PadStart([Day],2,"0")), Custom1 = #"Added Custom1", #"Changed Type" = Table.TransformColumnTypes(Custom1,{{"Year", type text}, {"Month", type text}, {"Day", type text}}), #"Inserted Merged Column" = Table.AddColumn(#"Changed Type", "Todaycode", each Text.Combine({[Year], [Custom], [Custom.1]}, ""), type text), Custom2 = #"Inserted Merged Column"{0}[Todaycode] in Custom2

 

 

I would apreciate the help to solve this, thanks in advance! 

 

Data from API

$
0
0

Hi everyone. 

I'm having big problems retreving some data from an restfull api. 

APi documentation example looks like this. 


Product

Usage

This endpoints allows retrieveal, creation, modification and deletion of products in Warehouze, it also allows retrieval of stock quantities pr. warehouse.

Get

Call requires at least one property name, blank query is allowed.

 

Product Properties
Name Type Description Updatable
AdjustedInStockQtyDecimal False
BarcodeString True
BarredBoolean True
BaseNumberString False
ColliQtyDecimal False
CompanyIdInt32 False
CreationDateDateTime False
CustomProductPropertyFiveString False
CustomProductPropertyFourString False
CustomProductPropertyOneString False
CustomProductPropertyThreeString False
CustomProductPropertyTwoString False
DataSourceDataSource0 Economic, 1 SmartWeb, 2 Local, 3 Magento, 4 GoldenPlanet, 5 Shopify, 6 WooCommerce, 7 FakturaFil, 8 IEXFalse
DeliveryDaysInt32 True
ExtraCostsDecimal False
GroupIdInt32 False
HeightDecimal False
IdInt32 False
IncludeInShoppinglistBoolean False
IsCollectionMasterBoolean False
IsMasterBoolean False
LastUpdatedDateTime False
LengthDecimal False
LocationIdInt32 False
NameString True
NotesString True
NotificationsString False
NumberString False
OrderedByCustomersQtyDecimal False
OrderedFromSuppliersQtyDecimal False
PoQtyMinDecimal False
SelectedVariantType1String False
SelectedVariantType2String False
ShippingMethodString False
ShippingPriceDecimal False
ShoppingQtyDecimal False
StockQtyDecimal False
SupplierIdInt32 True
SupplierProductNumberString True
TurnoverQtyDecimal False
UnitCostPriceDecimal False
UnitIdInt32 False
UnitPriceDecimal False
UnitSalesPriceDecimal False
VariantMasterIdInt32 False
VolumeDecimal False
WarehouseIdInt32 False
WeightDecimal False
WidthDecimal False
 
Sample Get call
var request = {
            Token:"Insert your token here",
            Query: [              "Number=130",              "WarehouseNumber=1",
            ],
            Properties: [            "Id",            "Name",            "StockQty",
            ],
        };
        $.ajax({
            url:"https://api.warehouze.io/Product",
            data: request,
            dataType:'text',
            type:"GET",
            traditional:true,
            success:function (data) {
                console.log(data);
            },
            error:function (data, xHr) {
                console.log(data);
                console.log(xHr);
            }
        });

Can anyone help me how to extract data?


custom function changes datatype during run time

$
0
0

In power query I got a custom function which picks up the data, does left join and returns the records properly. The tables are linked using t1.c1 and t2.c2. the data type of both columns is Text. It is tested using sample data file used for the function. When that custom function is called from some else place (i read all files from a folder and call the function for each of the file)...the function works correctly except for the data with last digit as zero. e.g. "01.10", "01.20" in this last value is zero wherein for t1 the value is automatically converted as "01.1" and in T2 the value is retained as "01.01". Bu then records doesn't get linked as the data alues are different. Please note, in both the tables field's data type is text, but it seems still it trims out zero from t1.c1 but not t2.c2. Also within custom function it seems to be working fine, but when caller makes the call to the function it doesn't return matching records. Any idea what could be the issue?

Buffer web query request

$
0
0

Hello there,

 

I have function which i am using to get statistics from POST method: fnMotorModes_Get

let Source = (AuthorizationId as text, StatisticsId as text) => let data = Json.FromValue([StatisticsSessionId=StatisticsId]), headers = [#"accept"="*/*", #"ScoutAuthorization"=AuthorizationId, #"Content-Type"="application/json"], web = Web.Contents("url", [ Content = data, Headers = headers, Timeout=#duration(0,0,0,10), ManualStatusHandling = {404, 400}]), source = ()=> Json.Document(web), result = Function.InvokeAfter(source, #duration(0,0,0,5)) in Source

 

This function i invoke like Custom Function only one time in MotorModes table:

Bessonnizza1992_0-1600269693919.png

Tables MotorModesTotal and MotorModesEvents are created via Reference button from MotorModes table. When i update data i check Fiddler Web Debugger and see that PowerQuery address to web service three times. One time for every table.

 

What do i need to add in query to make only one request to web service?

information standardization

$
0
0

good morning experts
very recently I have been facing a professional challenge with production data. I am nervous because things are not going as I would like, so all the help you can give me, I will be grateful.
I have the following table (sample)  onedrive table  and I need to start normalizing it to make it work fine in the data model
How should it look?

Count distinct values as a measure

$
0
0

I have column of NPS Score from 1-10. I am trying to group them as detractor (1-6), Passive(7-8) and Promoter(9-10) in a measure. Then I want to display is pie chart. I have this: 

Detractor = CALCULATE(COUNT('Aug'[NPS] < 7)) but it says count accepts a column reference as an argument.
AT the same time, I need to count only distinct user ID.
 
Thanks
~Nita

Pre-existing Queries

$
0
0

Hello All

 

I inherited a Power BI Report from someone who left a few years ago. The current report pulls from an SQL database that is "On-Prem."

 

We are eventually going to discontinue the On-Prem source and pull the same type of data from the same database which is being moved to Azure.

 

I noticed the current Report has a ton of queries the person created and it will be difficult to trace each one to figure out what they were doing. What is the correct way to do this when moving from On-Prem to Azure----do I just point the report to the new data source in Azure? Being that it is the same database, should all the existing queries in the report run as normal when we pull in the new data?

Transform table with maximum quantity of 100 per week

$
0
0

I doubt that this one has a solution in Power Query, however I thought to share it on this forum, maybe!

 

I have a dataset of weekly orders, which I need to limit to a weekly total quantity of 100. Thus remainder should be carried over to the following week and so on, till the last week. If there is remainder you open a new week. Always respecting the upper limit per week of 100.

 

Ramiroz_0-1600287676083.png

 

Dataset for original table:

let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nc/NCcAwCIDRXTwH6k9MhwnZf42mxKJgCqUHL48P0d4B24EEBXgOIYwySZ3UKFSSK87VZpdVJIskEDvVXNErMS6qfmqkp7K7NFSnU/tUbXbR3+p+e1w=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Week = _t, Orders = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Week", Int64.Type}, {"Orders", Int64.Type}}) in #"Changed Type"

 

Expand Columns for Table with Unknown Column Names

$
0
0

I seached Google for "power query expand all columns".

Top search result is from 2014 and seemed really complex, second item found did not seem simpler and only 3rd result was from this forum, by  from 2018. (note-to-self, 1st stop to seek answers should be this forum) 

 

In short, the trick is to get the list of column names (Table.ColumnNames), on the column which holds the table of unknown column names (using Table.Combine).

 

It you have a Table (say it is called TABLE_OF_TABLES) and it has a column that each value is a Table with unknown columns names (say column is names table_column), you can expand it using:

Table.ExpandTableColumn(
                TABLE_OF_TABLES,
                "table_column",
                Table.ColumnNames(Table.Combine(TABLE_OF_TABLES[table_column])),
                Table.ColumnNames(Table.Combine(TABLE_OF_TABLES[table_column]))
                )

Since it took me some time to get is right and since this looks like a pretty common task I am posting the functions I implemented. Hope others will benefit from it.

 

Function GetSheetDataFromFiles

= (sheetName) =>
let
    fileNames = FILE_NAMES, // A table with a single column called "Data Source File Name", each entry is a file name (full path)
    readFileData = Table.AddColumn(fileNames,
                "fileData",
                each GetSheetData([Data Source File Name], sheetName)
    ),
    expandFileData = Table.ExpandTableColumn(
                readFileData,
                "fileData",
                Table.ColumnNames(Table.Combine(readFileData[fileData])),
                Table.ColumnNames(Table.Combine(readFileData[fileData]))
    ),
    removeFileName = Table.RemoveColumns(expandFileData,{"Data Source File Name"})
in
    removeFileName

Function GetSheetData

= (fileName, sheetName) =>
let
    Source = Excel.Workbook(File.Contents(fileName), null, true),
    allData = Source{[Item=sheetName,Kind="Sheet"]}[Data],
    promotedHeaders = Table.PromoteHeaders(allData, [PromoteAllScalars=true])
in
    promotedHeaders

 


Format Panel

$
0
0

Hi everyone!

Do we have the possibility to enable/disable the switcher (Column subtotals) in format panel programmatically? After that, it should make an API call to powerbi.dataView and rerender the table.

 

Screenshot 2020-09-17 at 2.30.46 PM.png

Identify if string is made if of numeric values

$
0
0

Hi

 

I am trying to identify on my report, using PowerQuery, if a purchadse order number; the column is declared as a text value, had/is all nuermic values.  A number of Purchase orders numbers are prefixed with a letter(s).   I wanted to flag these as they are a different type of order.

 

I am using a couple of snippets taken from the web and came up with this:

 

=if
List.AllTrue({
Text.Length([PurchaseOrder])=7,
Value.Is(

              Number.From([PurchaseOrder])

                   )

                 })
then "YES"
else "NO"

 

 

So I am checking if a purchase order text lenght = 7 chatacters, then I want to check if they are all nuermic.  Its seems to partially work, ie its understands if it is all numeric, its just when it encounters a text character if fails and throughs up an error for thoses rows.

I asusmed adding this to an IF statement the outcomes would be false and I get my answer.

Chris.

 

 

 

Create list of remaining processes

$
0
0

So I have been working on a project that has me stumped

 

What i am looking to do is create a concatinated list of steps remaining. My data looks like this

part #        step         step description

123abc     001           cut

123abc     002           buff

123abc     003          mark

123abc     004         ship

 

 

My end resault that i am looking for is something like this

 

Part #     Step        Custom Column

123abc   001          buff,mark,ship

123abc   002         mark,ship

123abc   003         ship

123abc   004        

 

 

Now there are other fields, as this data comes out of a SQL Database. I know how to create the concatinated list using group by, and how to put the if statement in. But, not how it would lookup the next value. Any help would be appreciated, Thank you.

Power Query excel

$
0
0

 

 

Greeting all,

 

I have a small project, in which i have two sql diret query tables and one excel file in that iam trying to show the total of sql and excel for the same designation and for different dates but the total of sum output displaying is correct but its display for all the designation which is wrong. requesting your suggestion for correcting the issue.

 

 

 

Doc1.jpg

 

Table 1 - direct queryPunching Table - direct query
Id NoDescriptionEmpIdPunchTimeProjectdetail
1Fabricator117/09/2020 6:00Project A
2Fitter217/09/2020 7:00Project B
3Project A117/09/2020 19:00Project A
4Project B217/09/2020 19:00Project B
  118/09/2020 6:00Project A
  218/09/2020 7:00Project B
  118/09/2020 19:00Project A
  218/09/2020 19:00Project B
     
DAX Date    
     
     
     
     
Excel  
DateProjectdetailsDesignationTotal 
17/09/2020Project AFabricator5 
17/09/2020Project BFitter10 
18/09/2020Project AFabricator6 
18/09/2020Project BFitter3 
     
     
Relationship   
Dax date with Excel date   
Excel Designation with Table 1 Description  
ProjectDeatils Punching Table with Table 1 Description 

 

 

Query that doesn't work

$
0
0

It's probably just me... but my query isn't working. It tell me that 'G_EF.mximpl' is invalid.

 

Select
G.line_item_id
, G.price
, G_EF.mximpl
FROM
mn_price_master_li G
inner join
(
SELECT
max ( G_ED.date_impl ) as "mximpl"
, max ( G_ED.eff_start_date ) as "mxeff"
, G_ED.line_item_id as "Id"
FROM
mn_price_master_li G_ED
WHERE
G_ED.line_item_id = '6314925' OR G_ED.line_item_id = '908200'
GROUP BY
G_ED.line_item_id
) G_EF
ON
G.line_item_id = G_EF.id
and G.date_impl = G_EF.mximpl
and G.eff_start_date = G_EF.mxeff

 

But when I do the following, it does return a table with 3 columns as specified with the select statement in the from part...

SELECT

G_EF.*

FROM

(
SELECT
max ( G_ED.date_impl ) as "mximpl"
, max ( G_ED.eff_start_date ) as "mxeff"
, G_ED.line_item_id as "Id"
FROM
mn_price_master_li G_ED
WHERE
G_ED.line_item_id = '6314925' OR G_ED.line_item_id = '908200'
GROUP BY
G_ED.line_item_id
) G_EF

 

Viewing all 31232 articles
Browse latest View live


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