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
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]) ))))

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
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.