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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Creating a date column

Hi there,

 

I have a data model with two fact tables (Fact_actual and Fact_budget) and a Date table (Dim_Date). The date table should "link" both fact tables. The Fact_actual table has a proper date column and granularity at day level while the budget table instead does not have any date column but just one "FY" column and a "Period" column and granularity at month level..

 

To make things harder my company has a fiscal year (FY) starting on Dec and ending on Nov. This means that Dec 2022 is Period 1 of FY23 and Jan 2023 is period 2 of FY23.

 

Could you please help me in creating with PowerQuery a proper date column in my Fact_budget table from existing FY and Period columns?

 

Many thanks in advance.

 

Regards,

C.

1 ACCEPTED SOLUTION

Hi, @Anonymous 

Thanks for your quick response!

When the [Period]=1, the date is the Dec in the last year.Here are the steps you can refer to :

We can click "Custom Column" and enter this:

if [Period]=1 then #date([FY]+2000-1,12,1) else #date([FY]+2000,[Period]-1,1)

vyueyunzhmsft_0-1672966995533.png

Then we can modify the data type we want :

vyueyunzhmsft_1-1672967010648.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description, you want to generate a date column in Power Query according to the other columns?
First in Power Query , we can click "Custom Column" to add a column we need:

vyueyunzhmsft_0-1672888269975.png

Second, we can use IF() function to judge the other columns value and use the #date(2022,1,1) to generate a date value.

 

For your company logic , i am not fully understand , if the above method can not meet your need , you may provide some sample data and then detailed explanation for your need and the end result  as a table to us .

It will may be more clearly.

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

Hi Aniya, thanks for your support so far!!

 

I have replicated what I want to obtain in Excel:

 

cfugge_0-1672922934724.png

I have calculate the rightmost table using the following excel formula:

 

=DATE(IF([@Period]=1;[@FY]+2000-1;[@FY]+2000);IF([@Period]=1;12;[@Period]-1);1)

 

I need to replicate exacly the same in powerpivot creating a new column. Unfortunately all attempts I did resolved eitheir in sintax or in data error. For example the following:

 

= Table.AddColumn(#"Replaced Value", "Merged", each Text.Combine({"20", Text.From([FY], "it-IT"), Text.From([Period], "00"), "-01"}), type text)

 

produce data "error" in all records.

 

Many thanks,

C.

 

 

Hi, @Anonymous 

Thanks for your quick response!

When the [Period]=1, the date is the Dec in the last year.Here are the steps you can refer to :

We can click "Custom Column" and enter this:

if [Period]=1 then #date([FY]+2000-1,12,1) else #date([FY]+2000,[Period]-1,1)

vyueyunzhmsft_0-1672966995533.png

Then we can modify the data type we want :

vyueyunzhmsft_1-1672967010648.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

Thanks Aniya, this did work!

 

Regards and thanks again!

C.

Idrissshatila
Super User
Super User

Hello,

Check this video which will help you create a full date table 

https://m.youtube.com/watch?v=WybnTHDl-AM

 

and using this tool you could edit your fiscal year as you want.

 

If I answered your question, please mark my post as solution so it would appear to others, Appreciate your Kudos👍

Follow me on Linkedin

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Anonymous
Not applicable

Hi Idrissshatila,

 

thanks for posting that nice video (I didn't know about thi Bravo tool), hower my request was different. I do already have my Date Table. What I miss is a date column in my Fact_budget table. Could you help me on that?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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