SQL column renamed generating error in Power BI - powerbi

Context:
I have a dates table that I pulled in just by checking its box in the add data wizard which generated this
= Source{[Schema="dbo",Item="vw_ReportDates"]}[Data]
then I renamed the column ReportDayNo to DayOfReportMonth and I now get to see DayOfReportMonth in the data model but I get an error saying ReportDayNo doesn't exist. I'm not sure what to do here, the code doesn't explicitly call out for ReportDayNo so I'm not sure where to correct this.
Question:
how do I tell Power Query this column no longer exists?

You have following options (for Table.RenameColumns step):
Delete this step completely (if ReportDayNo was only column you renamed);
Delete the chunk {"ReportDayNo", "DayOfReportMonth"} from your step (if there are other columns you renamed);
Add 3rd argument MissingField.Ignore to your Table.RenameColumns function. More info:
https://learn.microsoft.com/en-US/powerquery-m/table-renamecolumns

Related

Power Bi web.contents Variables

Please excuse my lack of knowledge in explaining my problem as i have only just started learning Power Bi.
I am attempting to return data by using a dynamic variable within my source url.
Source = Json.Document(Web.Contents("https://api.****.com/jobs/{ID}/invoices", [Headers=[Authorization="Bearer "&GetToken()]]))
I have successfully returned the data i needed from multiple queries Blank Query 1 Query Names
However, i am trying to run a final query in which a job ID needs to be specified.
Source = Json.Document(Web.Contents("https://api.****.com/jobs/{ID}/invoices", [Headers=[Authorization="Bearer "&GetToken()]]))
With the bold item being the variable.
I have successfully returned values by hard coding the variable (seen below).
Hard coded variable
However, i would like to make dynamic in that it will return the values for all the Job ID's witin the "jobs" table.
Job Id's
I don't know if what im asking is possible, or if my explanation is good enough, but any help would be greatly appreciated!
What you are looking for is a custom function.
Make a function out of your above query by adding (ID) => in the first line and separating "ID" in your URL string.
(ID) =>
let
Source = Json.Document(Web.Contents("https://api.****.com/jobs/{" & ID & "}/invoices", [Headers=[Authorization="Bearer "&GetToken()]]))
in
Source
Of cause you can add all your other transformation steps too.
Now take your JobIDs table and add a column by invoking a custom function, select the above function and take the ID parameter from your ID column.
For every row you'll get a separate table and all that's left is simply expanding these tables into your query.
This will solve your problem.

POWER QUERY [Expression.Error] Cannot convert the value null to type Table

SOLVED USING A DIFFERENT APPROACH (see at the end)
I am trying to combine some queries into one by using the Table.Combine() function.
If I explicitly write the name of each query (e. g., Table.Combine({#"Name of query 1", #"Name of query 2"})) and then apply the changes, everything works fine.
However, since I want to make it dynamic, instead of writing a list of names, I pass the function a list of tables generated in a previous step:
So after I get this table, the next step is: = Table.Combine(PreviousStep[Value]). Note that Value is the name of the column that contains the tables. Apparently, by doing so this column of a table containing tables is converted to a list containing tables. This works fine (I can preview the resultset) until I hit that Apply changes button. When I do it, this message pops up:
I had a look at these threads: https://community.powerbi.com/t5/Desktop/We-cannot-convert-the-value-null-to-type-Table/td-p/391064, https://community.powerbi.com/t5/Desktop/We-cannot-convert-the-value-null-to-type-table/m-p/346056, but it didn't work. I've tried other approaches as well.
Further information:
Power BI Desktop version: 2.106.582.0 64-bit (June 2022)
Data source: combining existing queries that come from a single Excel file.
Steps followed to get that list of tables that I pass the Table.Combine() function:
let
Origen = #sections[Section1],
#"Convertido en tabla" = Record.ToTable(Origen),
#"Errores quitados" = Table.RemoveRowsWithErrors(#"Convertido en tabla", {"Value"}),
Personalizado1 = Table.SelectRows(#"Errores quitados", each Text.StartsWith([Name], "COMPRAS Y GASTOS")),
Personalizado2 = Table.Combine(Personalizado1[Value])
in
Personalizado2
I access all the queries I have (with the #sections keyword), convert it to a table, remove possible errors, filter to get the queries I want (the ones starting by "COMPRAS Y GASTOS") and then try to combine the queries).
A DIFFERENT APPROACH
What I wanted to do was merge tables that came from an Excel file, each of them referring to a year (2019, 2020, 2021, 2022). But I also wanted the combined table to update when new sheets were added on Excel (2023, 2024...).
I've tried many different approaches, like generating a dynamic list (from 2019 until the current year)... but for some reason none of them worked, even though the code apparently is correct.
So my new approach has been to create a sufficient amount of Excel sheets for the coming years (that are now empty, but when the new year comes the information will be filled in there), to create the queries referring to those sheets (they return empty tables) and merging those existing (but empty) tables with the ones from 2019-2022. This way, when data from 2023 is filled in in the sheet, the query is updated and it works.
It's a shame I couldn't actually solve the original problem I had, but this approach works.

Power Automate: how to catch which column was updated in Dataverse Connector

I'm starting from a "When a row is added, modified or deleted" connector, i'm passing in a switch connector that controls if the row is added, modified or deleted.
I'm then using the mail node to notify myself if a row is added, modified or deleted, in the case a row is added i have to include in the mail which fields of that row have been modified.
I can't find if this control is possible (check the row and compare it with the pre-modified version) and how to do it.
This is the embrional flow
As requested i'll try to be more detailed.
Please note that this is a POWER AUTOMATE FLOW so there is almost no code.
The CRUD connector takes 3 arguments:
-Change type (When an item is Added, Modified or Deleted)
-The table name (It's the Dataverse table name)
-The scope (Business Unit)
So i need to know if (for example in the output of this connector) there is a variable or other connector that contains which column changed and caused the trigger)
It's a question about the output or possible connectors related to the Dataverse CRUD node so there is NO CODE involved and no more "after-issue" flow specification needed to understand my request
A solution is to create a new field that keeps the current value of the original field and use trigger conditions to make your flow run only when those two fields don't match, meaning that the original field is updated and that its value has changed.

column "xx_xx" can only be updated to DEFAULT - DJANGO

Im trying to update some values (via django) at a table on Postgres that contains a Generated column.
This is the error im getting:
column "xx_xx" can only be updated to DEFAULT
See complete error here
You cannot edit generated column in a way other columns are saved/updated
As PostgreSQL documentation states
A generated column cannot be written to directly. In INSERT or UPDATE commands, a value cannot be specified for a generated column,
but the keyword DEFAULT may be specified.

How to change the data in a column in SAS Data Integration?

I have an existing ETL solution built-in SAS Data Integration, where one of the columns in initially set to have all null values. I want to populate that column with actual data. The original column in that table was set to receive numeric values with specific format and in format. After I am changing the code (that is the easy part), I notice that the column doesn't accept character values (I did not get an error, I just noticed the column still having all NULL values).
Can anyone help ?
So you have a table that is defined in Data Integration studio (1) and created by running the job (2) a long time ago with a numeric column. Let us call that table THE_TABLE that field the_field and the job, The_Job, that loads data into THE_TABLE
You must be aware of the fundamental difference
defining a THE_TABLE in DI studio, which creates a description of the table in meta data
creating THE_TABLE by running The_Job, which creates a file in a folder with data
If The_Job really creates THE_TABLE from scratch each time (which is typical for ETL jobs), it is sufficient to do change THE_TABLE and The_Job in DI studio. Your edits will only change the meta data, but the next time you run The_job, THE_TABLE wil be created with the the right structure.
However, if The_Job updates THE_TABLE or appends to it, your edits will not change the structure of THE_TABLE and your job will not be fit for the structure of the file THE_TABLE like it still exists in the folder, so you must convert THE_TABLE before running The_Job.
This can be done with a simple program like
data THE_TABLE;
set THE_TABLE (drop=the_field); /* forget about the numeric field */
attrib the_field length=$200 format=$200.; /* and create the character field */
run;
The correct attrib statement might well be in the code generated for The_Job somewhere.
Mind that in a typical setup with a development, test and production environment, you will need that program once in each environment.