Conver string to date fails without error message on power BI - powerbi

I have a power BI table (date_table_2) with a Date column with is detected as text, this is the format of the values when I plot then on a table:
fecha_2 = DATE(LEFT(date_table_2[FECHA];4);MID(date_table_2[FECHA];5;2);RIGHT(date_table_2[FECHA];2))
This does not generates errors on the editor and the new column seems to be fine
But when I try to plot it every wiget where I tried it breaks. E.G. this with the splitter :

Related

User Input Date in DAX column in POWER BI

I am trying to create a column in Power BI to group the rows of that data on.
I want the column to output text based on a comparison of dates.
Example:
projected = if(staticdate1 > dynamicdate, "XX", if(staticdate1 < dynamicdate && staticdate2 > dynamicdate, "YY", .... )
The dynamicdate presumably would be a filter or slicer the user could click a date on, thus changing the output of the column, and the totals per output would also change.
Is this possible? I've tried SELECTEDVALUE() but that didn't work. I tried creating a "what-if" parameter and adding that to a static date, but that didn't change anything when I changed the parameter.
That’s not possible since calculated columns are static and don’t recalculate on filter changes. This works with measures only.

PowerBi new column with switch statement and dates

I am trying to update background color of a column in PowerBi report. For that I am trying to create a column in power BI report and adding a switch statement to display background as
Red if dates greater than 2 weeks
Green if dates less than 2 weeks etc.,
The switch statement is working fine for strings but not with dates. Any suggestion or pointer would help to make dates switch work.
Working Switch for string conditions by creating a new column
columnNameColorNumber = SWITCH(MyData[name],"abc",1,"def",2,3)
New column shows numbers as expected
Failing Switch when trying to create a column in power bi with date conditions
columnNameColorNumber = SWITCH(MyData[reqDate],"(MyData[reqDate]>(Today()-14))",1,2)
New column shows error
Try:
columnNameColorNumber = SWITCH(TRUE(),MyData[reqDate]>Today()-14,1,2)
to add more switch checks it would look like this:
columnNameColorNumber = SWITCH(TRUE(),
MyData[reqDate]>Today()-14,1,
MyData[reqDate]>Today()-30,2,3)

Power BI Error - Cannot convert text into date type

I have a table in Power BI with blanks and also Text in the following format "01/11/2021 00:00:00"
When I highlight this date column and attempt to convert to data type to date I get an error.
"we cannot automatically convert the column to date type".
I'm not sure what's causing it to error. I have other columns that are formatted the same and they converted no problem.
Thanks

Slicer Only Show Month / Year and Filter On That

I have a table with a value ReportDate, which is in the format '03/01/2020'. I want to create a slicer in my Power BI report that displays only the format '03/2020' and the user can then select the value of the month and year to display, and it will display the data for that month (regardless of the day value). How would one go about doing this? I know technically I can add a new column in the database table, but unfortunately I do not have access to changes in the database and as such, would like a Power BI solution.
In the Power Query Editor create a new column with formula
Date.ToText([Date], "MM") & "/" & Date.ToText([Date], "yyyy")
Change [Date] to whatever your date column is called. Date.ToText converts a date time to text, which is then concatenated. You can then filter on that column. For issues like this it is best to have some sort of calendar table.
You can create a new column in using query editor in power bi:
mon_year = left(<column_name>, 3) & Right(<column_name>, 4)
Note: Make sure your are connected to dataset in import mode because in live connection you will not be able to create New Column in Power BI.

Power BI multiple lines on the y-axis

Explanation of the dataset I am using
I have a dataset containing the following values:
Timestamp
Value
Tag
The combination of a timestamp and a tag makes a row unique.
This dataset could, for example, make it possible to retrieve the value of tag A-A-A at 2019-05-20 00:00:00
Goal visualization (in Power BI)
The following image shows the visualization I would like to make in Power BI.
X-axis = Timestamp
Y1-axis = Value of Tag A-A-A
Y2-axis = Value of Tag B-B-B
Y3-axis = Value of tag C-C-C
Problem
I am unable to make a graph in Power BI that shows the Value of each Tag at a certain Timestamp.
I am curious how I can make Power BI understand that a Value corresponds to two values (Tag + Timestamp)
You should be able to achieve this by putting the Tag column in the Legend box as shown here: