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 :)
Related
I have a table that looks like the below photo.
table
I am trying to order Month No and Month Name correctly (starts from January), but the year and month no columns are in Whole number format.
None of the sorting methods is working.
add a calculated column and sort your table by this new column
Year&Month =
'Table'[Year] & FORMAT ( 'Table'[Month No], "00" )
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:
I have three columns Year, Month and YearMonth on each data source table.
Example,
Year - 2020
Month - 3
YearMonth - 202003
Data type and format of these columns are Whole number.
How can I create a common Calendar table which can be linked to the YearMonth column of the each table to make a relationship.
Is there any way?
Thanks in advance!
In PowerQuery
Reference one of your source tables
Select the Year, Month and YearMonth column
Remove other columns
Remove duplicate rows
and here's your calender table. You only need to set up relations between all the YearMonth columns and then you can hide Year, Month and YearMonth in all source tables.
I have columns with year and month in alphabet in power BI. I want to convert this to date and connect the table with the date table.
When I convert the column to date by clicking on the "ABC" symbol next to the year then all the data is converted as 01/01/2020. I want to use the months in the period column and the day of the month can be any value. So, the second row should be 02/01/2020.
You can use the following custom column under Edit Queries > Add Column > Custom Column to create your date:
I have a date for when someone last bought something (lastbuy) and have an end date (lastday) column and I want to create a new column with this new value which will be a whole number. FYI, lastday and lastbuy are both Date/Time data types. I tried the following:
Column_name = DATEDIFF(lastday, lastbuy, day)
_______________________________________________
Column_name = COUNTX('Table_name', [lastday] - [lastbuy])