PowerBi seems to lose state of connection depending on the field I pick - powerbi

I have a model with multiple tables. Four tables:
Two tables:
FactLocation
DimLocation
Are connected on:
LocationKey
And two more tables:
FactPurchaseOrder
DimPurchaseOrder
Are connected on:
PoKey
In addition:
DimLocation
FactPurchaseOrder
Are also connected on:
LocationKey
I have a table view, that I would like to use columns from all tables for.
I started out adding items from
FactLocation
dimLocation
everything was going fine. Then I added one column from
FactPurchaseOrder[OrderQuantity]
And that went fine. Then I tried to add:
FactPurchaseOrder[OrderDate]
Initially, I see that it recognized the date format, and it shows me, under Values, the OrderDate and underneath it Year, Quarter, Month, Day fields, but I also get the following error message, inside the Table visual:
Can't display the visual
Relationship Detection
There is a missing relationship between these fields. Use autodetect to search for relationship, or create them manually.
If I click on autodetect, it tells me No relationships were detected.
The same happens to the other columns from that table.
Any idea what I should be looking for? there is a relationship between the tables, and at least one field was allowed.

Related

Power BI Can't create relationship between two tables

I have tables like this diagram, and existing relationships are in highlighted boxes.
Then I tried to create relationship between Dates[Date] and Users[Last Hire Date], I got an error message saying there is an ambiguous conflict.
I don't see what conflict there is and how to overcome it?
The ambiguity is easier to see when you start with the Dates table. The arrows in the relations represent the filter direction. By selecting a certein Date in Dates, you are selecting several Emails in Time Log Aggregation where Date of Worklog equals Date. Simultaneously you are selecting several other Emails in Useres and Groups, where Last Hire Date equals Date. These 2 selections of Emails have nothing in common and they would match only by pure coincidence.
A workaround for this situation would be to duplicate the Dates table.

Power BI - One Master Table with 3 Transaction Tables

I have the tables as per the below diagram
There are vouchers in LedgerTrans connected with other 3 tables (but each one is independent of other 2 tables - means a voucher will be available in one of the 3 tables - same voucher won't be available across the 3 Project Trans tables).
I have given the connection as per below and the values are populating in 3 different Matrix visuals for each ProjTrans. The problem I am facing is, all the 3 visuals are summing up to the same amount, though the vouchers are showing correctly in each visual respectively. Is my approach wrong (the connection type)?
The 2nd problem is, I brought in the Project table to keep it as a slicer. The same project could be available in all the 3 ProjTrans. But when I select a project in the slicer, only the table with active connection is getting filtered out. The other 2 matrices are showing blank.
How to achieve active connections for all the 3 ProjTrans tables with a single Project table since Power BI would not allow more than 1 active connection?
The problem here isn't that Power BI does not allow more than one active connection. What is not allowed is having multiple paths for one table to filter another table since this results in ambiguities. Since you have bidirectional many-to-many relationships from the fProject tables to the fLedgerTrans table, you would have three distinct paths from dProject to fLedgerTrans if all your relationships were active.
The quickest fix would be to make all of the many-to-many relationships filter only in one direction (fLedgerTrans filters fProject tables). Then you should be able to activate the currently inactive relationships.
More generally, bidirectional many-to-many relationships are considered bad practice. I'd recommend reading the following article, especially if you don't quite understand what I've explained above:
Bidirectional relationships and ambiguity in DAX

Can't determine relationships between the fields

I've imported three tables into Power BI using a REST API, have added relationships between them, and am now trying to add fields from the various tables to a table on the canvas. The table names (from a Human Resources database) are named Employees, Job History, and Salary History.
Employees is joined to Job History using EmployeeID as a 1:Many relationship, and also to Salary History using EmployeeID on a 1:Many relationship.
I can add fields from the Employee table and EITHER the Salary History OR the Job History table to the table on the report canvas. However, if I try to add fields from all three tables, I'm seeing the error 'Can't display the data because Power BI can't determine the relationship between two or more fields'.
Could anyone advise where I'm going wrong? Many thanks.
If I understand correctly, you have a model like in this picture:
The way PBI filters work is: The 1: side table filters the N: side table. Filters propagate that way. So in this case, you can filter JobHistory with data from Employees, and SalaryHistory with data from Employees. But the 2 fact tables can't relate because the filters don't propagate that way.
Look into DAX measures like RELATED(), RELATEDTABLE() and USERELATIONSHIP() that might work for you.
Without that, I don't think you can use data from the 3 tables, since you have a model with 2 Fact Tables.
Someone correct me if I'm wrong.

Relationships break when adding column using query

I have a dataset with multiple tables and relationships between those tables which were auto detected when I connected to my PostgreSQL server.
But when I add a column using query, those relationships are no longer effective in the report view and all my graphs show 'blank' labels.
One thing I noticed is that in the Data view, the uuid which are used to make the relationships (my foreign keys in PSQL) appear with brackets and those brackets desappear after I add columns in query.
Before:
After:
I don't know if this helps.
I have tried adding columns with custom queries or simply duplicating an existing column.
I don't have any issue when adding columns using DAX.
Thanks,
Change the type of the column by yourself as one of the first steps in the query editor. You can either go with the brackets or without. Make sure its the same for every other key-/foreign key.
If you lost your relationship you can edit it by yourself. After your ID´s are proparly formatted go to Model (the last on the left pane) and drag and drop your relationship form one table to the other. This way it should work again.

Get "not allowed for columns on the one side of a many-to-one relationship" errors

i have created Power bi project, It is working fine in the beginning but when i refresh my datasource , i get this error " not allowed for columns on the one side of a many-to-one relationship" . Any can help me ??
I resolved this issue by going into the relationship, right clicking to view properties,
and making it a Many to One Relationship.
Power BI sometimes automatically creates relationships between the queries that are being used to drive the data in the reports. When I have encountered this error or errors like it in the past I:
Go into Manage Relationships
Verify that there is a relationship listed
Evaluate the From and To relationships that are listed as active
Delete any invalid From and To relationships between separate data sets
My most common issue in the past has been that I will have two very different queries pulling data from separate sources with similar column names and Power BI will generate a relationship between them that is invalid. After removing the relationship it has always resolved my issue.
In my case issue was related to the fact that Power BI was threating "SQL View" as a "Table" and as a result it was creating relations for it.
Although I've checked the "Manage Relationships":
and removed one relation which was not reasonable the issue was still persisting.
Then issue solved when I had looked in the "Relations"
tab and found unreasonable relations related to my View and removed them.
None of these answers helped me. For me I received this error when trying to refresh my dataset which had previously worked for some time. After investigating I found the schema of the source database had changed. Two fields that previously didn't allow nulls now allowed nulls and had null values for some rows. My Power BI model still expected these fields not to contain nulls but was throwing this same and very misleading error:
Data source error: Column 'x' in Table 'y' contains blank values and this is not allowed for columns on the one side of a many-to-one relationship or for columns that are used as the primary key of a table. Table: y.
Initially on seeing this error and opening up my report in PowerBI Desktop and going to Modeling > Manage relationships. I looked for a relationship on table y for column x, but no such relationship existed!? Was I confused? You bet.
After investigating further I discovered the database schema change and resolved by updating my Power BI model by going to the data model editor, expanding table y in the Fields panel on the right hand side, selected field x, expanded "Advanced" in the Properties panel and changed "Is nullable" from No to Yes. I then applied the changes, saved the report and refreshed the dataset.
I followed these steps
Step 1: Go to the Model section from the left side of the Power BI Desktop
Step 2: Delete all the relationships (or connections) amongst the tables that have been created by Power BI itself while you were working with the Power Query Editor
Step 3: Click 'Refresh visual and data' option in Home (besides the Transform Data button)
It worked and loaded the new data and also applied the automations done in the query editor.
I got this error on a completely new table made in Power Query, weird since I had no chance to create a relation yet.
Easy fix: Apply a filter that removes all blanks on that column - apply the filter, and then delete this new filter again
Another problem you might have is that "Autodetect new relationships" is turned on:
This is a setting that disables auto-detecting relations under "File/Options & settings/Options/Current File/Data Load/Relationship/Autodetect new relationships after data is loaded"
I had the same issue, after spending hours of searching for a fix and not finding anything, I started scratching around and found the problem took 1second to fix. My issue specifically, was a an additional relationship created within the model. The connection showed up as a "dotted" line one of my tables. I deleted the relationship, refreshed. Done.
This happens when your table or connected tables in excel, contain blank row, for resolving this issue you will need to click anywhere in the excel table, then click on the table tools, then resize table and Select the entire range of cells to include all rows, make sure no blank rows are included then save and get back to your PowerBI then again refresh it, all will work.