cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
icdns
Post Patron
Post Patron

How to get December values of each year and latest current month of the year

Hi, 

 

Would really need your help in creating a dax. I have a 6 years worth of data (cummulative) from 2017 to 2022 and it's on a monthly view.

Need your help in creating a dax to display the december values of each year and the current month available month for 2022. 

 

Please see expected output below. 

 

icdns_0-1647484193466.png

 

Thank you so much in advance!

 

6 REPLIES 6
v-yalanwu-msft
Community Support
Community Support

Hi, @icdns ;

Is your problem solved? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @icdns ;

Sorry, I don't fully understand your original data model and the results you want to output, quarterly and monthly. Can you share a simple file or more information?

 

v-yalanwu-msft
Community Support
Community Support

Hi, @icdns ;

You could create a measure as follows:

Measure = 
var _max=CALCULATE(MAX('Table'[Date]),ALL('Table'))
return IF(NOT( ISINSCOPE('Table'[Date].[Month])),
          CALCULATE(SUM([value]),FILTER('Table',MONTH([Date])=12 || EOMONTH([Date],0)=EOMONTH(_max,0))))

The final output is shown below:

vyalanwumsft_0-1647831819874.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yalanwu-msft ,

 

Thank you for this. However, it is not working properly if I dril down to QUARTER and MONTHLY. Is it possible to include it in the dax? I am using a dimension date table. 

 

 

Thank you so much in advance!

amitchandak
Super User
Super User

@icdns , Create a column year month in Table YYYYMM

 

and with help from date tbale

 

calculate(LASTNONBLANK(Table[Year Month], Sum(Table[Value])), allexcept('Date', 'Date'[year]))

 

Try like

calculate(Sum(Table[Value]), filter(allseleceted('Date'), 'Date'[year] = max(Date[Year]) ), filter(Table, month(Table[Date]) = calculate( month(Max(Table[Date])),filter(allseleceted('Date'), 'Date'[year] = max(Date[Year]) ))))



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

hi @amitchandak , 

 

Thank you, the formula is now displaying the december values of each year. But it doesn't display the latest current month of the year value 😞 How can I tweak the dax?

 

Ex:

In below example, it's displaying the value for 2017 to 2021 but not 2022. 

icdns_0-1647494510896.png

 

 

Thank you so much for your help!! 

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors