Forum Discussion
Adding a Text value in a date filter
- 4 years ago
Hi Malsk1_1 ,
So you don't have a date column with all those values.
Your query says, you have merged the tables and got the dates in place, so I got confused.
Suppose you have following 2 tables:
Table1
Table2
Make sure datatype of both Date columns in both tables is set to TEXT.
In Power Query editor, click on Table2 and add a custom column:
Then add following formula:
You will get the following:
Now I will remove previous column from Table2 and just keep the new caluclated column as follows:
Now in both Table1 and Table2, I am giving name to the columns as Date as this will help me in next steps and their datatype as Text.
In Power Query editor, you will have to append them together. Make sure the column name is same in both the tables.
Click on Table1 on the left and on the top ribbon select Append Queries as shown:
Then the following window:
You end up the required output:
Now add an index column to this table, to make sure your slicer displays data in right order:
Then apply your changes. Go to Data tab in Power BI and sort your Date column by Index column:
You will end up with slicer in the required format:
Thanks,
Pragati
Pragati11 @I am assuming that I need to create a calculated field to say something like this.
if max date from table 2 does not exist in table 1, then show the max date in table 2 & Flash else show the dates from table 1.
how can I write this?
Hi Malsk1_1 ,
So you don't have a date column with all those values.
Your query says, you have merged the tables and got the dates in place, so I got confused.
Suppose you have following 2 tables:
Table1
Table2
Make sure datatype of both Date columns in both tables is set to TEXT.
In Power Query editor, click on Table2 and add a custom column:
Then add following formula:
You will get the following:
Now I will remove previous column from Table2 and just keep the new caluclated column as follows:
Now in both Table1 and Table2, I am giving name to the columns as Date as this will help me in next steps and their datatype as Text.
In Power Query editor, you will have to append them together. Make sure the column name is same in both the tables.
Click on Table1 on the left and on the top ribbon select Append Queries as shown:
Then the following window:
You end up the required output:
Now add an index column to this table, to make sure your slicer displays data in right order:
Then apply your changes. Go to Data tab in Power BI and sort your Date column by Index column:
You will end up with slicer in the required format:
Thanks,
Pragati