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

Matrix visualisation

$
0
0

Hi everyone,

 

I have an excel file with data like this:

 

Value AValues connected
RedBlue; Green; Purple
GreenYellow; Blue
RedGreen
YellowBlue; Green; Red
BlueYellow; Red

 

Now i'd like to make a visualisation (Matrix) in which I see combination intensity between Value A and values B. For example with color intensity or something. How should i handle this within Powerbi?

 

Thank you a lot!

 

Regards, Mark


Power Query Optimization: Error Handling and Transformation on Date Columns in minimal steps

$
0
0

Hi,
I am trying to optimize the following into a single (or least) steps so that I can do the transform on the "target due date" and avoid creating a custom column altogether

#"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"Discovered Date", type date}, {"Target Due Date", type date}}), #"Replaced Errors" = Table.ReplaceErrorValues(#"Changed Type1", {{"Target Due Date", null}}), #"Added Custom" = Table.AddColumn(#"Replaced Errors", "Due Date", each if [Target Due Date] = null then Date.AddDays([Discovered Date],30) else [Target Due Date], type date),

 What would be the best way?

 

Thanks,

 

F

Create Heirarchy in Power Query (not bi) Using Columns in Query that pulls from multiple tables

$
0
0

The current query I have is made up of merging multiple tables with some column calculations as well.

Everything works perfectly but their is no structure to the heirarchy.

 

For example, I have [Year] [Quarter] [Month]

When I put these into a pivot table as columns and only show columns with data, it works fine.

ex1.png

 

 

 

 

However, if I want each [Month] to show, even if the data is empty, it shows Jan through Dec four times under [Quater], making 48 columns.

ex2.png

 

 

 

How can I create a heirachy so that only certain month sow under certain quarters, and then weeks under months, etc. ?

WORKDAYS formula in Power Query

$
0
0

 

Hi Guys

 

I am trying to find a solution that exist in EXCEL (WORKDAYS function) that can do the same thing in Power Query

Below I have a Delivery Date and I want to substract Shipping and WHS days but only days that are working days. 

So in column Release date it is substructing all days including Weekends but what I want to acheive is the Releas date WORKING DAYS ONLY that is substrating only working days. 

 

Hopefully you can help me 

 

Thank you for your efforts 

 

 

 

Del dateShippingWHSSubstractReleas date
Del date - (shipping +WHS)
Releas date WORKING DAYS ONLY
Del date - (shipping +WHS)
27-03-2023522-03-2020-03-20
13-04-2031409-04-2007-04-20
06-04-2041501-04-2030-03-20
02-04-2022429-03-2027-03-20
02-04-2031429-03-2027-03-20
02-04-2011231-03-2031-03-20
02-04-2032528-03-2026-03-20
02-04-2051627-03-2025-03-20

New column with max values from table 2 based on conditions in columns in table 1 dinamically

$
0
0

Hi everyone,

My name is Julian and I am a recent user (I am not a programmer) of Power Query with Excel as a tool for data manipulation. Now I am stuck with a step which has taken my several days of google searching with no success. As a result of that search I found you in the Power BI community and I believe you may help me based on your successful background in the community. Please let me introduce you my case:

I have two query tables, table1 has several fields a shown in figure 1. I am trying to add a new column whose values depend of the other columns dynamically. Each cell in this column is the max value in other table’s column, named “Value”. For that purpose I first filter Table2, based on four conditions. Then I get the max value by using List.Max (See formula below). For filtering table2 I have used static values, however, I’d wish to use values contained in each row of table1’s columns. It can be said that Table 1 is a subset of Table 2, where I managed to create a StartDate Column to get a data range. Then a Max value from column “Value” in table 2 can be obtained.

Table 1

(Condition 1)

(Condition 2)

(Condition 3)

(Condition 4)

Result

Column1

Column2

StartDate

EndDate

MaxMinValue

Data1

A

19/03/2020

19/03/2020

3.4195

Data1

B

20/03/2020

09/04/2020

3.4195

Data1

B

16/01/2020

20/03/2020

3.4195

Data1

C

21/11/2019

16/01/2020

3.4195

Data1

C

18/11/2019

21/11/2019

3.4195

Data1

C

15/10/2019

18/11/2019

3.4195

Data2

D

08/03/2019

15/10/2019

3.4195

Formula to add a new column:

 

Table.AddColumn(Source, "MaxMinValue", each List.Max(Table.SelectRows(Table2, each [Column1]="Data1" and [Column2] = "A" and [Date] > #date(2020,2,26) and [Date] <= #date(2020, 4,9))[Close])) //Where Source = Table1

 

Table 2

Column1

Column2

Date

Value

Data1

A

09/04/2020

20

Data1

A

08/04/2020

19.695

Data1

A

07/04/2020

19.845

Data1

B

06/04/2020

18.17

Data1

B

03/04/2020

16.9

Data1

C

02/04/2020

17.195

Data1

C

01/04/2020

16.985

Data2

D

31/03/2020

17.815

Data2

D

30/03/2020

16.29

I would appreciate your valuable help since all my tries have failed. Thank you in advance.

Regards

Julian,  )

Calculate the previous date for each item

$
0
0

Hi All,

 

I want to create a Card graph wherein the Score for this specific team for a specific Quarter Shows

Splicers would be Year and Quarter. Then Card shows Score of each team (team A and B)

 

For the query question, the solution I can think of is that i want to create a column (not a measure since there would be no total calculation of Scores) for Previous quarter Dates. I have a "Logging Date" wherein users log their Score but it's for a previous quarter.

 

Data sample below is the calculated quarter based on the date:

DateTeamScore (1-10)YearPrefix
5/2/2019Team A62019Q2
5/10/2019Team B72019Q2
8/4/2019Team A62019Q3
8/15/2019Team B82019Q3
10/2/2019Team A92019Q4
10/2/2019Team B92019Q4
1/3/2020Team A82020Q1
1/10/2020Team B102020Q1

 

I would like to create a column showing that this Score is actually for a previous quarter (see 2 columns below) 

DateTeamScore (1-10)YearPrefixPrev QtrPrevious Qtr Yr
5/2/2019Team A62019Q2Q12019
5/10/2019Team B72019Q2Q12019
8/4/2019Team A62019Q3Q22019
8/15/2019Team B82019Q3Q22019
10/2/2019Team A92019Q4Q32019
10/2/2019Team B92019Q4Q32019
1/3/2020Team A82020Q1Q42019
1/10/2020Team B102020Q1Q42019

 

I have tried doing the basic conditional formatting wherein if Quarter shows Q4 then change to Q3, Q3 to Q2, etc. but When doing a splicer for Quarter and Year, the date for 1/3/2020 and 1/10/2020 should be for Q4 2019 not Q4 2020.

 

I'm not sure if there's any other way around with the final outcome that I want. I'm okay with a different approach.

Need to convert date-time and durations to ticks in PowerQuery

$
0
0

I am fetching data from a data source which requires me splitup my queries and provide a start and stop time for each fetched block.
It only accepts times as clock ticks.

Question:
Is there a clever and reliable way to convert a date-time stamp and/or a duration to ticks in PowerQuery (M)?

With reliable I mean both:
Which takes into account leap seconds e.c.t..
Which will work with a scheduled refresh (does not require a local component).

Denormalize automaticly a datadate

$
0
0

Hi the community,

 

I recieve a dataset very normalized with 2 differents kind of data : D001=Work order Data, D002 = Pumped Volume Data

Data Code   TX1_VALUE  TX2_VALUE TX3_VALUE TX4_VALUE

D001            Agent1         Equip1           1/1/2020    WO1

D001            Agent2         Equip2           2/1/2020    WO2

D002            Pump1         500                 2018          4500    

D002            Pump2         600                 2019          5000     

etc. with many different data code which represent very different types of data (and I have up to 10 TXn_VALUE fields)

For my exemple of course I receive another table with the parameters :

Data Code  Field            FieldNature

D001          TX1_VALUE  AgentCode

D001          TX2_VALUE  EquipmentCode

D001          TX3_VALUE  WorkOrderDate

D001          TX3_VALUE  WorkOrderNumber

D002          TX1_VALUE  PumpNumber

D002          TX2_VALUE  NomimalVolume

D002          TX3_VALUE  Year

D002          TX4_VALUE  PumpedVolume

 

And of course for Power BI, I need to automaticly add field with the "Field Nature" as the name of the data and the related data extract. Something like that :

Data Code   AgentCode EquipmentCode WorkOrderDate WorkOrderNumber PumpNumber NomimalVolume Year PumpedVolume

D001            Agent1       Equip1                1/1/2020            WO1

D001            Agent2       Equip2                2/1/2020           WO2

D002                                                                                                                    Pump1             500                     2018          4500    

D002                                                                                                                    Pump2             600                     2019          5000     

 

I can rename the field of every table/chart of my dashboards but I really want to avoid that...

I'va tested a lot of different solutions but no success.

Any Idea in PowerQuery/M ? (or DAX but I don't believe).

Thanks a lot.

 

 


How to specify a login / password in PowerQuery so that it gets access from GoogleSheet

Web Connector - error 308 Permanent Redirect - issue

$
0
0

Hello fellow PowerBI nerds, 

 

I have to include in my dashboard the number of Covid-19 cases and deaths in England by Region. Therefore, I have been trying to conenct to the 2 CSV files available on UK Gov website: https://coronavirus.data.gov.uk/ . If you click on the links you will be able to see the CSV are downloading fine and have data.

 

I have used the Web Conector in Power BI and I am getting the error below. I've been looking online for answers on how I can deal with this but I didn't find anything useful yet. Has anyone experience anything like this before? Is this not a PBI issue but a problem with their website? Would I have to get in touch with them?  

 

Any help would be appreciated!!!

 

"DataSource.Error: Web.Contents failed to get contents from 'https://coronavirus.data.gov.uk/downloads/csv/coronavirus-cases_latest.csv' (308): Permanent Redirect
Details:
DataSourceKind=Web
DataSourcePath=https://coronavirus.data.gov.uk/downloads/csv/coronavirus-cases_latest.csv
Url=https://coronavirus.data.gov.uk/downloads/csv/coronavirus-cases_latest.csv"

 

Thanks,

Mal

Combine Table

$
0
0

Hi everyone! I need your help about combine 2 table without same column.

I have a table 1 (Calendar table) and Table 2 (List of Product).

I would like to build a table with, for every row in table 1 complete list of row in table 2.

 

Example :

Table 1

Col 1|Col2

01/01/2020|True

02/01/2002|False

03/01/2020|False

 

Table 2

Col 1

Item_1

Tem_2

Item_3

 

Result

Table1.Col 1|Table1.Col 2|Table2.Col 1

01/01/2020|True|Item_1

01/01/2020|True|Item_2

01/01/2020|True|Item_3

02/01/2020|False|Item_1

02/01/2020|False|Item_2

02/01/2020|False|Item_3

03/01/2020|False|Item_1

03/01/2020|False|Item_2

03/01/2020|False|Item_3

 

Thanks in advance

 

BR 

 

Danilo

Dataflow Refresh Fail Since it Refers to Another Entity

$
0
0

I'm trying to move a dataset up to a dataflow and transferred everything by simply copying the advanced editor and pasting it into blank queries within the dataflow query editor.

 

After doing this and following login prompts and selecting the on prem gateway for one of the data sources, the preview for each query will refresh and look correct, but when I save and close the dataflow, the refresh itself in the Power BI workspace fails with the following error: 

Error: On-Prem execution not supported for entity '[my data]' since it refers to another entity... RootActivityId =[...]

 

Any help, even a link to "dos" and "donts" of dataflows would be wonderful.

Connecting to OData Source through ADFS

$
0
0

I have a workstation in DomainA, I am needing to pull data from an OData Source located in DomainB. To log into web resources in DomainB, we get redirected to an ADFS login page. The entire environment uses smart cards and PINs, we have no username/Pwd and no user knows their password. 

 

Through a browser, I can access the OData source, it will prompt me for ADFS login when I do(uses a smart card and PIN), and I am there.

 

On PowerBi Desktop, as soon as it redirects to the ADFS login, the PowerBI call fails, it does not prompt me for Auth or give me any options for authenication. Is there any way to do this with PowerBI Desktop or do I have to build this from a workstation physically located in DomainB?

Replace null(s) in a list

$
0
0

I’m new to M language and I need help regarding converting JSON data using Power Query. As a whole, the process is working however when a “null” is encountered such as shown in the “list” view below, and the “Extracted Values” function is invoked, not all indexed rows (13) are included in the output string (only 12 rows are past to the string). Therefore, when the Split Column by Delimiter (;) function is invoked the data in the converted table doesn’t aligned properly under the respective headers.  To further complicate things, the nulls locations are random and can be more than one.

 

Question: Is there a way to replace all “nulls” with a value such as a -1?  This would retain all 13 rows in the transformation process.  I have tried a few of the “list” functions but I could not get any to work… 

Any examples would be greatly appreciated!

Example list view:

 Power Query List View.jpg

 

Cannot access support

$
0
0

I am trying to reach support through the Power Platford admin pages, but I get the message:

 

Your account does not have permissions to create support requests for this service. Try selecting another support plan

 

I have a power bi pro account, what license do I need to access support?

 

TIA


PQ is converting an account number to a date. Help Please

$
0
0

I have a csv with account number in the format  ##-####.

On import PQ is converting some of these account #'s to dates if the first 2 digits are 1-12 and the last 2 digits are a valid day in the month. the rule isn't exactly that, but close. 

I dont have control of the source file.

This behaviour occurs right in the source import.

Example:

02-8514   becomes 14-Feb   and was converted to 2/14/2020

02-5882   becomes  Feb-85  and was converted to 2/1/1985

02-1490  stays as it should

02-1509  stays as it should

ARGHHH!!!!   

All my searches come up with the opposite trying to help me convert text to dates. 

How do I stop this behavior it seems so rooted!!!

I know this is built on a lot of excels functionality and it was a problem there.

 

a;lsdkjf;oiwfenfon!!! [Head smashing keyboard because it seems as productive as this fight with the backend of the app]

If anyone has a work around please let me know. 

EDIT - added example converts

Missing a Step in using Folder to connect to multiple csv files

$
0
0

I am a newbie and I am trying to read a folder to bring in multiple csv files into powerbi.  I have scowered the community, help files and youtube videos before turning to the forum to resolve an issue that is probably simple but for some reason I cant see to find documenation on.

 

In converting from file folder, I understand all of the steps needed except for reloading the intial combined table after the sample file has been used to create all of the transformation steps.

 

Here is where I am stuck:

 

-I connect to my folder

-I see the list of my files and choose "transform data"

-I click on the "Content" column to combine all of the files an

-I accept the default for using the First File for sample.

-Query Editor opens with the helper queris and an outputed result for the combined files

-I click on the Transform Sample File and make a series of changes that I can see in my applied steps.

-However, the default output does not change when I promote headers and this is where I am stuck.  It reflects all the changes until I get to the step where I am promoting a row to be used as headers, the default output no longer is referencing the column names as [Column 1, 2, 3, etc] and its givng me the triangle with an exlamation mark (and on apply and close I get the error message "The column 'Column1' of the table wasn't found".

 

I am sure its a simple reload of the final output with my applied steps, but I cant seem to find how to make this work (invoke function?  what do i put in the parameter box?).

 

I know its going to be a duh! moment, but I do appreciate if someone can point me in the right direction.

 

Thanks.

 

 

 

 

 

 

Dataflow connecting to SharePoint Online Lists

$
0
0

Hello,

I have a dataflow that is connecting to 4 different SP lists, and then appending them. I've tried to create this in both Power Query and in dataflows, and am not able to get it to sucessfully load. 

The largest list is about 13k rows and doesn't need to be refreshed. How do I prevent the dataflow from refreshing that table? I've disabled load, but I think it's still trying to refresh the table each time.

 

I have had to extend several fields to get the lookup valudes - mostly on the people picker fields. if there's a better way, please let me know! I initially expanded out the "fields as text" record and removed everything else, but that was actually taking longer than just expanding the fileds that I needed.

 

The Last two rows were auto generated.

 

The BRQ2019 table is the one that doesn't need refreshed - just appended.

 

Thanks!

Kim

 

 

let
  Source = SharePoint.Tables("https://site"),
  #"Navigation 1" = Source{[Name = "BRQ"]}[Content],
  #"Expanded Entity" = Table.ExpandRecordColumn(#"Navigation 1", "Entity", {"Entity"}, {"Entity.1"}),
  #"Expanded Payer" = Table.ExpandRecordColumn(#"Expanded Entity", "Payer", {"Payer"}, {"Payer.1"}),
  #"Expanded PostingType" = Table.ExpandRecordColumn(#"Expanded Payer", "PostingType", {"PostingType"}, {"PostingType.PostingType"}),
  #"Expanded BatchType" = Table.ExpandRecordColumn(#"Expanded PostingType", "BatchType", {"BatchType"}, {"BatchType.BatchType"}),
  #"Expanded Analyst" = Table.ExpandTableColumn(#"Expanded BatchType", "Analyst", {"Name"}, {"Analyst"}),
  #"Expanded ReleasedBy" = Table.ExpandRecordColumn(#"Expanded Analyst", "ReleasedBy", {"Name"}, {"Released By"}),
  #"Expanded CreatedBy" = Table.ExpandRecordColumn(#"Expanded ReleasedBy", "CreatedBy", {"Name"}, {"Created By"}),
  #"Expanded ModifiedBy" = Table.ExpandRecordColumn(#"Expanded CreatedBy", "ModifiedBy", {"Name"}, {"Modified By"}),
  #"Choose columns" = Table.SelectColumns(#"Expanded ModifiedBy", {"CheckNumber""RemitNumber""DepositAmount""BatchAmount""TakebackAmount""AdjustmentAmount""PatientPayAmount""Interest""Balanced""AutoPostBatchNumber""AutoPostBatch""PaymentApplicationInvoiceAndMemoBatchNumber""BatchNumber""DepositReference""PeriodToPost""DocumentNumber""DocumentDate""DateBatchCompleted""AnalystNotes""PaidClaimCount""ShortPaidClaimCount""DeniedClaimCount""DeniedClaimAmount""PendingClaimCount""PendingClaimAmount""UnappliedPaymentCount""UnappliedPaymentAmount""TotalClaimCount""TotalAmount""StatusValue""DateBatchReleased""ReleaseNotes""DocuWareLink""Created""Modified""Entity.1""Payer.1""PostingType.PostingType""BatchType.BatchType""Analyst""Released By""Created By""Modified By"}),
  #"Renamed columns" = Table.RenameColumns(#"Choose columns", {{"Entity.1""Entity"}, {"Payer.1""Payer"}, {"PostingType.PostingType""Posting Type"}, {"BatchType.BatchType""Batch Type"}, {"CheckNumber""Check Number"}, {"RemitNumber""Remit Number"}, {"DepositAmount""Deposit Amount"}, {"BatchAmount""Batch Amount"}, {"TakebackAmount""Takeback Amount"}, {"AdjustmentAmount""Adjustment Amount"}, {"PatientPayAmount""Patient Pay Amount"}}),
  #"Appended query" = Table.Combine({#"Renamed columns", BRQ2019, BRQAKFCPrivatePay, BRQCDVA}),
  #"Transform columns" = Table.TransformColumnTypes(#"Appended query", {{"AutoPostBatchNumber"type text}, {"PaymentApplicationInvoiceAndMemoBatchNumber"type text}}),
  #"Replace errors" = Table.ReplaceErrorValues(#"Transform columns", {{"AutoPostBatchNumber"null}, {"PaymentApplicationInvoiceAndMemoBatchNumber"null}}),
  #"Appended query 1" = Table.Combine({#"Replace errors", BRQ2019}),
  #"Appended query 2" = Table.Combine({#"Appended query 1", BRQAKFCPrivatePay}),
  #"Appended query 3" = Table.Combine({#"Appended query 2", BRQCDVA}),
  #"Transform columns 1" = Table.TransformColumnTypes(#"Appended query 3", {{"AutoPostBatchNumber"type text}}),
  #"Replace errors 1" = Table.ReplaceErrorValues(#"Transform columns 1", {{"AutoPostBatchNumber"null}})
in
  #"Replace errors 1"

Date table two years from today instead of fixed date

$
0
0

Hi,

My date table always starts from a fixed date 1/1/2017. How can I change it so it always starts two year from today's date?

 

 

let Source = #date(2017, 1, 1), Custom1 = List.Dates(Source, Number.From(DateTime.LocalNow())- Number.From(Source), #duration(1,0,0,0)), #"Converted to Table" = Table.FromList(Custom1, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}), #"Inserted Week of Year" = Table.AddColumn(#"Renamed Columns", "Week of Year", each Date.WeekOfYear([Date]), Int64.Type), #"Inserted Month" = Table.AddColumn(#"Inserted Week of Year", "Month", each Date.Month([Date]), Int64.Type), #"Inserted Quarter" = Table.AddColumn(#"Inserted Month", "Quarter", each Date.QuarterOfYear([Date]), Int64.Type), #"Added Custom" = Table.AddColumn(#"Inserted Quarter", "FY4", each "FY"& (if Date.Month([Date])<= 6 then Number.ToText( Date.Year([Date])) else Number.ToText(Date.Year([Date])+1))), #"Added Custom1" = Table.AddColumn(#"Added Custom", "WW", each "WW" & (if Date.WeekOfYear([Date])-27+1<=0 then Number.ToText(52+Date.WeekOfYear([Date])-27+1) else Number.ToText( Date.WeekOfYear([Date])-27+1))), #"Sorted Rows" = Table.Sort(#"Added Custom1",{{"Date", Order.Descending}}), #"Inserted First Characters" = Table.AddColumn(#"Sorted Rows", "First Characters", each Text.Start([FY4], 2), type text), #"Inserted Last Characters" = Table.AddColumn(#"Inserted First Characters", "Last Characters", each Text.End([FY4], 2), type text), #"Merged Columns" = Table.CombineColumns(#"Inserted Last Characters",{"First Characters", "Last Characters"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"FY"), #"Added Conditional Column" = Table.AddColumn(#"Merged Columns", "Custom", each if [WW] = "WW1" then "WW01" else if [WW] = "WW2" then "WW02" else if [WW] = "WW3" then "WW03" else if [WW] = "WW4" then "WW04" else if [WW] = "WW5" then "WW05" else if [WW] = "WW6" then "WW06" else if [WW] = "WW7" then "WW07" else if [WW] = "WW8" then "WW08" else if [WW] = "WW9" then "WW09" else [WW]), #"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"FY4", "WW"}), #"Merged Columns1" = Table.CombineColumns(#"Removed Columns",{"FY", "Custom"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"FYWW_C_PQ") in #"Merged Columns1"

 

 

Avoiding Duplicate counts question

$
0
0

I have the below table and would like to visualize the following:

  • To calculate the number of unique Technical IDs in relation to Process A and Process B
    • For example, there are 6 SAS 234s in relation to Process B however, Power BI will visualize that there are only 2 SAS 234s since the others have other values in the cell (SAS 234, SAS 567, etc.)
    • I can't get Power BI to take the values in the cell that are separated by commas.  
    • Do I nned to remove the commas and create a separate column?

Any idea??

 

Product IDCompanyNature of BusinessProcess AProcess BTechnical ID
325ABCRetail01SAS 234
246XYZOil & Gas01SAS 234, SAS 567
100123Manufacturing01SAS 234, SAS 230, SAS 205
112456Insurance10SAS 234
102ABCBanking01SAS 220
325XYZRetail01SAS 220
246123Oil & Gas01SAS 234
100ABCManufacturing01SAS 234, SAS 567
112XYZInsurance01SAS 234, SAS 230, SAS 205
102123Banking10SAS 234
100456Oil & Gas10SAS 220
Viewing all 31288 articles
Browse latest View live


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