Date Table Returning zero values - powerbi

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.

Related

Create Rows to the table where the data is missing for specific dates in power BI

I have a table with below columns in my dataset. We have monthly revenue for each resellers in this table.
For few resellers, there will be no data for some particular months, as they didn’t generate revenue on those months. I want to create rows for those resellers with the missing date and the revenue for those missing dates to be updated as blank.
Please advise how we can achieve this.
Current data:
Expected result:
For the missing dates you need to create a date table using the CALENDAR function like this:
Date table = CALENDAR(MIN(Date), MAX(Date))
This will create a table with a single colmn containing all the dates in your table with filled gaps (even if you don't have certain dates in your table). Then you need to create a relationship between your table and the date table.
When you use the date and the revenue in a visual lets say table or matrix all dates will be visible but the revenues will be blank (except for those that actually had a value in revenue).

Aaggregate fact table sales based on a dim table column that are related through another dimension table in power BI

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.

Power Bi Extract a Column value based on some another field in different Table

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]))

How to make a 1:1 relation between dates

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

Calculated column based on a disconnected slicer

I'm not sure I've summarised this question correctly, so I'll add a description below of the actual problem.
We have a report that displays data for 'jobs'. These jobs have a few relevant date fields on them such as Created Date, Completed Date and Invoice Date. We currently have 3 slicers on the report that work as expected based on these dates.
Users sometimes use all 3 slicers at the same time and end up with all sorts of useless data. No matter how many times we've told them to reset the filters before changing the date slicers, they keep forgetting to do that.
They also do not want to have 3 separate reports.
We've been tasked with providing them with the following:
Something that lets them select what they want to filter on, with the options only being Created, Completed or Invoiced
A slicer that works based on the option they selected above.
We've tried creating a calculated column that is set to one of those dates based on the option selected in the disconnected slicer, and then adding a slicer that works off that column, but we aren't having any luck. The values in the calculated column are not correct
This is what we've done in attempting to solve the problem:
Create a measure that captures the selected value
SelectedMeasure = SELECTEDVALUE('Date Filter Options'[Name],"Created Date")
Create a calculated column to set the appropriate date value
Please note we're only testing with two out of the three possible values at the moment.
Selected Date Filter = if(jobs[SelectedMeasure] = "Created Date", (jobs[Created Date (DateOnly)]), (jobs[Completed Date (DateOnly)]))
What we're finding is that the Selected Date Filter column does not update with the correct date value, even after we change the slicer and the measure updates as expected.
We're totally stumped - I'm aware we are probably a fair bit away from the correct solution, so any help would be appreciated
Not quite sure how to best present the data model, but here are the relevant fields of the 'jobs' table
jobNumber: string
jobId: guid
CreatedDate: date
CompletedDate: date
InvoicedDate date
The Date Filter Options table just consists of one column with these options:
"Created Date"
"Completed Date"
"Invoiced Date"