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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Separate year/month column

Hello comunity, I have a problem. I need to separate values for whole year 2018 and then values for year 2019 but by months. Is there any DAX solution so I can take exact year like in SQL? Or do you have any other idea ? 

1 ACCEPTED SOLUTION

Hi @Anonymous 

You may add Month column and Year column in query editor first.Then create measures like below.Attached the sample file for your reference.

 

Salary for Year 2019 = CALCULATE(SUM(Table1[Salary]),Table1[Year]=2019)
AVG for year 2019 = [Salary for Year 2019]/DISTINCTCOUNT(Table1[Month Name])

Regards,

 

Community Support Team _ Cherie Chen
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
TomMartens
Super User
Super User

Hey,

maybe you want to refer to this DAX functions:

or from within Power Query using "Add column"  --> "From Date & Time".

 

If this does not answer your question, please share an example what you want.

 

Regards,

Tom 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable


@TomMartens wrote:

Hey,

maybe you want to refer to this DAX functions:

or from within Power Query using "Add column"  --> "From Date & Time".

 

If this does not answer your question, please share an example what you want.

 

Regards,

Tom 


I want to create table like this but i cant find a dax solution for this, how to represent Salary for year 2019 by months and then calculate an average for it.

 

   Salary for Year 2019
NameSalary for year 2018AVG for year 2019JanFebMar
Milan20030303030
Adam150585010025
David17550455550
Dominik10067805070

Hi @Anonymous 

You may add Month column and Year column in query editor first.Then create measures like below.Attached the sample file for your reference.

 

Salary for Year 2019 = CALCULATE(SUM(Table1[Salary]),Table1[Year]=2019)
AVG for year 2019 = [Salary for Year 2019]/DISTINCTCOUNT(Table1[Month Name])

Regards,

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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