Relationship calendar with simple facts table not showing date - powerbi

Can someone please explain me why this relationship isn't working?
I have a calendar table with
ADDCOLUMNS(
CALENDARAUTO(),
...
)
Which contains a date column related to "Document date" in Table1. Both columns are "Date" type (also tried with Date/Time).
I get the following table:
The first column is "Date" from the Calendar table.
All other columns are from Table1.
Why is "Date" empty?

Related

PowerBI Creating New Table using values in other tables

I have multiple data tables in a Power BI report and am hoping to create a new summarized table with new column and selected columns and rows from other data tables. Each data tables are quite large with different data elements so it's difficult to append the tables together to form one big table. Below is a simplified version just to illustrate the issue and what i wanted to achieve:
ID 1 Name is Orange
ID 2 Name is Apple
The last column: Sum Value (Agg.) in each table are Measures.
The result table I am trying to get is like below:
So basically I wanted to use Table 1 and Table 2 to create a new summarized Table with an added column 'Item Name' replacing the 'ID' column and the 'Sum Value' column. So far I've tried the Summarize and AddColumn function but couldn't get Measure Sum Value to the table.
If anyone can help, that'd be great!!
Thankyou
Michelle
This reshaping should really be done in PQ but if you insist on DAX, here you go.
Table =
VAR a = ADDCOLUMNS(
SUMMARIZE(Orange, Orange[Sum Value (Agg.)]),
"Item Name",
"Orange"
)
VAR b = ADDCOLUMNS(
SUMMARIZE(Apple, Apple[Sum Value (Agg.)]),
"Item Name",
"Apple"
)
RETURN UNION(a,b)

Search by selected Item in PowerBI

I have a product detail table having columns publisher, author, Category and Title. I would like to create a search by where i can select it to search by author, by title or by publisher. Depending on my choice I should be able to search that item. I would like to show it in my PowerBI Report.
This is the input table
This is the output
I found a solution, I made a unique id "isbn13p" in the dim_competitor_prods table. After that made a Slicer table, with columns selection, categories and isbn. Selection column contained my filter data "author, publisher, title".
After creating the Slicer table, made a relationship, one to many between dim_competitor_prods and Slicer table.
The code for Selection table is given below.
SlicerTableAuthCatTitle =
UNION(
SELECTCOLUMNS(dim_competitor_prods, "Selection", "author", "Category", dim_competitor_prods[author], "isbn",dim_competitor_prods[isbn13p]),
SELECTCOLUMNS( dim_competitor_prods, "Selection", "publisher", "Category", dim_competitor_prods[publisher], "isbn",dim_competitor_prods[isbn13p]),
SELECTCOLUMNS( dim_competitor_prods, "Selection", "title", "Category", dim_competitor_prods[title], "isbn",dim_competitor_prods[isbn13p] )
)
Then just put a filter for Selection and another for Categories in the Report.

Power BI - Get the Days of current Month

I have a column "Days of Month" which is just rows from 1 to 31 and a filter above with the date as you can see in the screenshot below. I want to filter this column to show me the days of each month based on the filter above.
For example if the date above is 2/2/2020 i would like to see 28 rows on my column.
I tried several solutions but i couldn't achieve this.
Can anyone help me ?
I was able to get this working by duplicating the date table and creating a relationship to its duplicate on year and month.
Add a [YearMonth] column to your date table
Duplicate the Dates table as Dates2
Create a many-to-many data relationship between Dates and Dates2 on the [YearMonth] column. Set the cross filter direction to Single (Dates filters Dates2)
Set up your report to use a slicer or filter on Dates[Date] and display Date2[Day] in a table visual. Here is the result:

Power BI Text to Long Date Errors For Data Model

I have Sales table and this table contains OrderDate column this column foreign key. And i have Dates table this table has date column i want to connect for this two table on orderDate and date column. But orderDate columns type is text and i did'nt change the type how can i do this ?
I solved hard way. I am gonna explain;
There is example data : 6 Haziran 2014 Cuma I splitted this data like dd/mm/YYYY
Day=LEFT(Sales[OrderDate],SEARCH(" ",Sales[OrderDate])-1)
Year = RIGHT(LEFT(Sales[OrderDate],SEARCH(" ",Sales[OrderDate],12)),5)
For Month i used conditional column. Like: each if Text.Contains([OrderDate], "Ocak") then 1 else if .....
And finally OrderDateForConnection = Sales[Day] & "/" & Sales[Month] & "/" & Sales[Year] and its worked :)

Calculated Column based on other table. Direct Query sql

I have 2 tables sourced by direct query to sql.
Table1 contains 3 columns "Fruit", "Number", and "Date".
Table2 contains 2 columns "Country", and "Fruit".
Table2 is linked to Table1 with a 1->*(Many) link from Table2[Fruit] to Table1[Fruit].
I want to create a new column in Table2, containing the average of "Number" for a specified range of dates.
Any ideas of how this can be done?
Add a measure like AverageNumber = SUM(Table1[Number])/COUNT(Table1[Date]). The date range comes automatically from your filters/slicers, and the average will show correctly for a particular fruit due to the relationship you have added.