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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jgarden6
Frequent Visitor

Need Help With Dax

I need help with Dax.  I'm new to Dax so excuse my lack of knowledge.  I have data that I want to sum a column for each year.  I have data for years 2012 through 2020.  I wnat a measure that shows the 2012 sum in a column for each year.  I then can caluculate the growth rate from the base 2012 sum for each year.  ie) 2012 to 2012, 20012 to 2013, 20212 to 2014, etc.  I can get the sum for each year but I need the 2012 amount repeated for each yearly sum so I can c

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @jgarden6 

Download sample PBIX with measures and data shown below.

I'm not sure what your data looks like - are you storing the year as text, a number or as a date?

But if your Year column is numerical and just holds the year then try this measure

 

Measure = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'), 'Table'[Year] = 2012))

 

vals.png

 

If you have a column of dates then use this measure

 

Measure 2 = CALCULATE(SUM('Table2'[Value]),FILTER(ALL('Table2'), YEAR('Table2'[Date]) = 2012))

 

vals2.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

8 REPLIES 8
PhilipTreacy
Super User
Super User

Hi @jgarden6 

Download sample PBIX with measures and data shown below.

I'm not sure what your data looks like - are you storing the year as text, a number or as a date?

But if your Year column is numerical and just holds the year then try this measure

 

Measure = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'), 'Table'[Year] = 2012))

 

vals.png

 

If you have a column of dates then use this measure

 

Measure 2 = CALCULATE(SUM('Table2'[Value]),FILTER(ALL('Table2'), YEAR('Table2'[Date]) = 2012))

 

vals2.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


it worked .  thank you so much.

pranit828
Community Champion
Community Champion

HI @jgarden6 

Create a measure as below

measure1 = CALCULATE(SUM('table'[column]),FORMAT('table'[date],"YYYY") = "2012")





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

I had a syntax issue so I fixed that.  It shows the summed value for 2012 but it is blank for all the other rows.  I'm summing by year.  When  I do my divide (base year 2012 / each subsequent year , I get blanks for 2013 thru 2020 and that is because the 2012 sum is not shown for each year.  Help again

@jgarden6 

Please see my response below.

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


measure1 = CALCULATE(SUM('Exported_Data'[Taxable Value],FORMAT('Exported_Data'[date],"YYYY") = "2012")
I must be doing something wrong.  I'm getting a message "Too many arguments...something abour parsing
Can you see what I'm doing wrong

Hi @jgarden6 

You're missing the closing ) for SUM

measure1 = CALCULATE( SUM('Exported_Data'[Taxable Value] ) , FORMAT('Exported_Data'[date],"YYYY") = "2012")

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


That fixed the measure but I still don't get that value to show up on the other rows for the year.  What I need to do is to divide each year that is summed on a column divided by the base year (2012) summed on the same variable.  This will give me the growth for each year from the base year 2012.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.