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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
AdsChan
Regular Visitor

Add a custom column - syntax help

Hi,

 

I'm trying to merge tables in Power BI, but I was trying to use a calculated column I made using DAX as the key - of course, this won't work as I couldnt see the column when I tried to do the join. I then read that I could do this if I added the column in Power Query first.

 

My question - below is the DAX expression I used to create the calculated column. How do I write this as a custom column in Query editor?

 

FinancialYear =

VAR StartDate = IF(MONTH('DataTBL'[ReportMonth])<7,DATE(Year('DataTBL'[ReportMonth])-1,7,1),DATE(Year('DataTBL'[ReportMonth]),7,1))

Return

(Year(StartDate)+1)

 

 

Thank you in advance

 

3 REPLIES 3
wdx223_Daniel
Community Champion
Community Champion

how could your DAX code can get a year number from Month Column?

Sorry, I should have changed the name, that column called ReportMonth is actually a date field, but the values for the day is always just the 1st day of the month as we use it as a way to identify reporting month

AdsChan
Regular Visitor

I found a solution which is just using this

 

=Date.Year(Date.AddDays([Date],184))

 

However, it seems to be really slow as my data has about 10 million rows. Doesnt seem to be a good idea to add the column in Power Query beforehand?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.