Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filtering by Financial Year

I am trying to create a new column with financial year, i tried the following but it had the following error.

Can anyone advice me. Thanks so much in advance.

2.png

1 ACCEPTED SOLUTION

I think I know what is going on, your table name need to be in single quote because its name is DAte, try following

 

Date = 
IF (
AND (
'Date'[Date1] >= DATE ( 2015, 4, 1 ),
'Date'[Date1] <= DATE ( 2016, 3, 31 )
),
"FY15", "")


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

15 REPLIES 15
Anonymous
Not applicable

Hey @Anonymous 

The date column isn't displayed in your screenshot; maybe that column isn't formatted correctly? 

 

The other screenshot doesn't show the full expression, but the contents of your IF statements displayed in the screenshot look to be formatted properly. 

Anonymous
Not applicable

@Anonymous @parry2k 

The date column is showing error.

I am not sure about the data table id, only added a new column for the financial date ("date")
Is there anything else i need to do prior to this step?
Thanks so much in advance

 

Capture.JPG

@Anonymous how you are adding date column? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

under modelling->new column.

thanks in advance

@Anonymous then what? what expression you are doing to add date



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

i added the following into the forumla bar.

I am not sure if is it correct or it need to be done some other way?

my end result is i need to have a visual that filter by Financial Year.
any help & hint is appreicated.

@Anonymous aha, you are adding date column which is new column and you are referring the same column in your DAX expression and that's the issue, replace Date with Date1 which I believe already exists in your table

 

Date = 
IF (
AND (
Date[Date1] >= DATE ( 2015, 4, 1 ),
Date[Date1] <= DATE ( 2016, 3, 31 )
),
"FY15",
IF (
AND (
Date[Date1] >= DATE ( 2016, 4, 1 ),
Date[Date1] <= DATE ( 2017, 3, 31 )
),
"FY16",
IF (
AND (
Date[Date1] >= DATE ( 2017, 4, 1 ),

Date[Date1] <= DATE ( 2018, 3, 31 )
),
"FY17",
IF (
AND (
Date[Date1] >= DATE ( 2018, 4, 1 ),
Date[Date1] >= DATE ( 2019, 3, 31 )
),
"FY18",
0
)
)
))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

i replaced the date with date1 but it still say "the syntax for '[date1] is incorrect.

my current date1 format is as shown in pic.
not sure where i have gone wrong.

 

Capture.JPG

@Anonymous lets add a simple expression to make sure it is working, add new column with following expression

 

Date 2 = Your Table Name[Date1]


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

yes, is working

table2.JPG

@Anonymous let's add one if condition in date and see if it works and then add the next add one and so on until you get where the issue is. I'm wondering last value you are return is 0 which should be string like "0" , but I don;t think that is the issue though.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k i added only 1 condition and is the same error "the syntax for [Date1] is incorrect.

I think I know what is going on, your table name need to be in single quote because its name is DAte, try following

 

Date = 
IF (
AND (
'Date'[Date1] >= DATE ( 2015, 4, 1 ),
'Date'[Date1] <= DATE ( 2016, 3, 31 )
),
"FY15", "")


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

it works! Thank so much! Smiley LOL

@parry2k 

 

parry2k
Super User
Super User

@Anonymous I guess your table name id Date and your column name is also Date, correct?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.