Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
I want to add a new column to a table with the months defined from the dates column can't seem to get this working. Any help greatly appreciated.
Dates = IF (
[Date_Column] >= (2023, 04, 01)
&& [Date_column] <= (2023, 04, 30) then "April 2023"
else "")
Liekwise what would i have to do to do this for other months eg
Dates = IF (
[Date_Column] >= (2023, 04, 01)
&& [Date_column] <= (2023, 04, 30) then "April 2023"
else "",
IF (
[Date_Column] >= (2023, 05, 01)
&& [Date_column] <= (2023, 05, 31) then "May 2023"
else "",
Solved! Go to Solution.
It seems unnecessary to create this IF/ELSE logic.
Instead, simply create the Year Month field in the CALENDAR table and use it as follows:
1) Create "Calendar" table using the following DAX.
2) Link 'Data' table to 'Calendar' table on [Date] columns.
3) Then just pull 'Calendar'[Year Month] onto the visual with whatever your 'Data' columns are...
Regards,
Nathan
P.S. If you truly need to create a Calculated Column within another table, it can be done as follows:
I just did a test and am actually surprised to find that Power BI handled NULL date values in my Fact 'Data' table without any issues.
Attached is the link to my PBIX for reference.
https://drive.google.com/drive/folders/13HqZmd_S7YEcTLWUr2txNN-7ysRug3ZX?usp=drive_link
Hopefully the PBIX is helpful to you.
Regards,
Nathan
I just did a test and am actually surprised to find that Power BI handled NULL date values in my Fact 'Data' table without any issues.
Attached is the link to my PBIX for reference.
https://drive.google.com/drive/folders/13HqZmd_S7YEcTLWUr2txNN-7ysRug3ZX?usp=drive_link
Hopefully the PBIX is helpful to you.
Regards,
Nathan
It seems unnecessary to create this IF/ELSE logic.
Instead, simply create the Year Month field in the CALENDAR table and use it as follows:
1) Create "Calendar" table using the following DAX.
2) Link 'Data' table to 'Calendar' table on [Date] columns.
3) Then just pull 'Calendar'[Year Month] onto the visual with whatever your 'Data' columns are...
Regards,
Nathan
P.S. If you truly need to create a Calculated Column within another table, it can be done as follows:
Thank you this is great help however when i try n connect this calendar table to my data i get this along with the error message 'Table content' and this under the calendar dax code. Can you please tell me what i'm doing wrong. I chan ged teh data column of my data to short date is that coorect. Also I ahve some Nulls in my date column will that be an issue ?
Thanks
Check out the May 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
17 | |
14 | |
13 | |
12 | |
10 |
User | Count |
---|---|
11 | |
10 | |
7 | |
7 | |
6 |