Forum Discussion
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.
- Anonymous3 years ago
Hi nic2023 ,
Raw data:
Final result:
Steps of the soltuion:
1.Add a custom column to return MonthYear based on the date column.
2.Group by the date column.
3.Add a custom to return the majority of the month year.
4.Fill down/up the monthyear.
5.Remove unneeded columns and expand the all rows, you will get the result.
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.
4 Replies
- Mahesh0016
Super User
nic2023 I hope this helps you. Thank You.
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.- nic2023Frequent Visitor
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?
- AnonymousNot applicable
Hi nic2023 ,
Raw data:
Final result:
Steps of the soltuion:
1.Add a custom column to return MonthYear based on the date column.
2.Group by the date column.
3.Add a custom to return the majority of the month year.
4.Fill down/up the monthyear.
5.Remove unneeded columns and expand the all rows, you will get the result.
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.
- nic2023Frequent Visitor
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!