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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
nic2023
Regular Visitor

Power Query Date Column: to display month based on an existing column

We are currently in month of August, I have a raw data with a column contains Dates ranged from later June to all possible July dates, the majority of the dates are July.  

The desired outcome is to add a column to show all entries (can be June or July) with a standardzied "Jul-23" as the majority dates within tha report, i.e. those entries dated with June also flagged as "Jul-23"

Is there any formula related to show MMM-YY from averged date or majority date point of view?

Thanks in advance. 

nic2023_0-1693196142241.png

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @nic2023 ,

 

Raw data:

vstephenmsft_2-1693376782336.png

 

Final result:

vstephenmsft_0-1693376727060.png

 

Steps of the soltuion:

1.Add a custom column to return MonthYear based on the date column.

vstephenmsft_1-1693376756849.png

 

2.Group by the date column.

vstephenmsft_3-1693376821178.png

 

3.Add a custom to return the majority of the month year.

vstephenmsft_4-1693376855215.png

 

4.Fill down/up the monthyear.

vstephenmsft_6-1693376999412.png

vstephenmsft_7-1693380239812.png

 

5.Remove unneeded columns and expand the all rows, you will get the result.

vstephenmsft_8-1693380444826.png

 

You can also download my attachment for more details.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @nic2023 ,

 

Raw data:

vstephenmsft_2-1693376782336.png

 

Final result:

vstephenmsft_0-1693376727060.png

 

Steps of the soltuion:

1.Add a custom column to return MonthYear based on the date column.

vstephenmsft_1-1693376756849.png

 

2.Group by the date column.

vstephenmsft_3-1693376821178.png

 

3.Add a custom to return the majority of the month year.

vstephenmsft_4-1693376855215.png

 

4.Fill down/up the monthyear.

vstephenmsft_6-1693376999412.png

vstephenmsft_7-1693380239812.png

 

5.Remove unneeded columns and expand the all rows, you will get the result.

vstephenmsft_8-1693380444826.png

 

You can also download my attachment for more details.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

 

Hi Stephen, Would you be able to elaborate more on the above step 5? How to 'expand all rows"? 

5.Remove unneeded columns and expand the all rows

 

Thank you so much!

Mahesh0016
Super User
Super User

@nic2023  I hope this helps you. Thank You.

Mahesh0016_1-1693204632965.png

 

 


Create Custom Column
MMM YY =
Date.ToText(#date(Date.Year([DATETIME]), Date.Month([DATETIME]), Date.Day([DATETIME])), [Format="MMM-yy", Culture="de-DE"])

 

Note :
 change Culture="de-DE" based on your Region and location.

Thanks @Mahesh0016 

Yes, the Jul-23 can be populated as advised.

However the June dated entries are also show their real month as Jun-23 

The desired outcome is to show all entries with Jul-23 as the majority dates within tha report. 

Is there any formula related to show MMM-YY from averged date or majority date? 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors
Top Kudoed Authors