I have a table about occupational accidents in a Company. This table have a date column about when this accidents happened. What I want to do is make another table about occupational accidents dates with day, month and year columns which is joined with the another table by the date I extracted from the Occupational accidents table (In my database known as OPS table.
I thought it would be easy but when i tried to do the relationship beetween OPS[Fecha](This is the field date from OPS table) and Date[ID](Date is how i called my new table and ID is the field joined with the another table), the relationship returns me as many to many what makes no sense because i think it should be 1 to 1.
This is what i did and my result:
1.This is the table I'm talking about.
I added as a new query:
Convert to table.
I changed the column name to ID
5.Then I try to make the relationship between these 2 tables waiting to get a 1 to 1 relation and I get this:
What I want to get is something like this relation:
When you add a new query and after converting it to a table, add a new step to remove duplicates(screenshot below). Once this is done you will be able to create a One-to-Many relationship between these 2 queries. But you CAN'T be able to create One-to-One.
Also, please search online on how relationships work in Power BI. I recommend this video: https://www.youtube.com/watch?v=-4ybWQSRcOY
Related
I am pretty new to Power BI and DAX so I apologize if my vocabulary isn't entirely accurate, however I'm having trouble with the functionality of the program.
Goal: I would like to create a visual that returns the count of ID's based off of date using a date table
Summary of Problem: I create a relationship between a date table and fact table. When creating a visual using the date table field [date], and fact table count of [Id's] the relationship between the date table seems to break and return nothing.
Details: I created a date table and created a relationship to a 'Lead' Database table using the respective "Date" field (in the Main date table) to the "CreatedDate" (in the 'Lead' table). Shown Below
*Uses a 1:Many relationship with a single crossfilter moving towards the 'Lead' table
When I pull in a table in the visualizations, using a the dimensions of 'Main Date Filter'[Date] and count of 'Lead'[Lead Id], it seems theres no relationship between the 'Main Date Filter'[Date] and 'Lead'[CreatedDate] because none of the dates populate and counts all the ID's into a blank date
Also I made sure to turn off filters off for this example and strip all relationships to just the lead object and date
Here are the further data types of each of the fields that are being related
Thank you for taking the time to find a solution and I appreciate the help as this simple problem has been driving me crazy!
Once again the goal is to just return the count of Id's per date and I don't understand why this is not working.
I have a situation, I want to get the reseller sales for "WASHINGTON REGION"; the database is "AdventureWorksDW2019" and I have the column relation as follows:
The geography details are populated in "DimGeography" table,
The reseller details are populated in "DimReseller" table, where each geography, say in my case, WASHINGTON could have more then reseller; hence, there is many-to-one relation between "DimReseller" and "DimGeography" and the column in relation is "GeographyKey"
The fact table "FactResellerSales" table is populated with reseller-sales; hence there is many-to-one relation between "FactResellerSales" and "DimReseller" tables; the column in relation is "ResellerKey"
--and the fact table has indirectly relation with "DimGeography" table
I am struggling generate a DAX query to get reseller-sales total belonging to "Washington"; could anyone help me understand to achieve this?
Thank you for giving your valuable time; pls find the screenshot of the schema diagram attached to this email.
I have 2 tables.
I am joining both of them via a 1 to many relationship.
The KPI I want to use is in Table_1, but I'm grouping it based on a column in Table_2.
When I throw the measure onto PowerBI, it gives the same value for all rows.
I created the measure like this:
sales_in_cents := (sum(Table_1[Sales]) * 100)
When I group the data using a column from Table_2, it gives me the same value for each row in Table_2.
Why is this?
How do I fix it?
Edit #1
It's similar to this, but I do have a relationship.
Edit #2:
Table_1 has a 1 to many relationship with Table_2 and cross filter direction is set to single.
Edit #3:
I think I need to use some sort of combination of the LookUpValue and/or RelatedValue Function.
Table_1 has a 1 to many relationship with Table_2 and cross filter direction is set to single.
That means that Table_1 can filter Table_2, but not the other way round. This is why you get repeated values when using a column from Table_2 and a measure based on the Table_1, the filter context doesn't propagate
How to solve it
Measure with TREATAS:
https://www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/
Calculated column in Table_2 that would use RELATED (as each row in Table_2 has a single, related row in Table_1, for referencing the many side you need to use RELATEDTABLE)
changing the relationship to bidirectional - it can create ambiguity, so I don't recommend it
This model seems a bit peculiar, is it something like a Table_1 is monthly budgets, while Table_2 is daily sales? In general star schema is recommended in the tabular models, it makes life much easier if you can use that schema
I have a Power BI table with some columns as given below:
Table1 - Columns(Project, Program, Name, Attribute, ID)
Example of table1:
Now I have a different measure which is used to view Power BI report. It also has some fields as given below:
Measure1 - Columns(Project, Name, Attribute, and few more)
Example of Measure:
Now I want to add ID (which is available in Table1) as Measure1 is being used to view report. How can I display ID based upon Name and Project.
Can anyone guide or help how to solve it?
If you can do this in your source Database using left join between this 2 tables.
If not, then you can use virtual relationship in DAX:
Display_ID = CALCULATE(min(Table1[ID]), TREATAS(VALUES(Table1[Project]), Measure1[Project]), TREATAS(VALUES(Table1[Name]), Measure1[Name]))
I have two tables which have counts and sales based on dates and one of them also have customer ID. The counts are not same when we see by customer and summary. I also have customer filter on my dashboard. What I want to achieve is if no customer is selected the count should come from summary table otherwise it should come from customer if multiple or one is selected in the filter.
Customer Table
Summary Table
Any hints, I have tried lookupvalue function but I cant put date as search value from date table.
It's much easier to use Measures, instead of creating calculated tables to obtain those metrics. Also, summarized tables would not have the same filter context your are looking for.
Measure 1
Total Customers =
DISTINCTCOUNT('Customer Table'[CustomerID])
Measure 2
Total Sales =
SUM ( 'Customer Table'[Sales])