Forum Discussion
Month End Data_% Change
- 4 years ago
Hey gmasta1129 ,
I have to admit that I do not fully understand why it's necessary to calculate the MoM change based on the Month's end date.
Nevertheless, my sample data looks like this:The I use the below 2 DAX statements to create calculated columns, one returns the month end date of the current month based on Run Date 2 value and the other returns end of month of the previous month.
End Of Month = EOMONTH( 'Table'[Run Date 2] , 0 )End Of Prev Month = EOMONTH( 'Table'[Run Date 2] , -1 )Then my table looks like this:
Finally, I use the below DAX statement to create a calculated column that returns the MoM change:
MoM change = var prevMonthValue = LOOKUPVALUE('Table'[Utilization_Overlall] ,'Table'[End Of Month] , 'Table'[End Of Prev Month] ) return if( isblank(prevMonthValue ) , BLANK() , ( divide( 'Table'[Utilization_Overlall] , prevMonthValue ) - 1 ) * 100 )I recommend, reading this article Time patterns – DAX Patterns, the article provides almost everything for date-based calculations, and also explains why using a dedicated calendar table is so important.
Regards,
Tom
Hello Tom,
Thank you for the quick response.
I copy and pasted the formula and receive the error message below...
"A table of mulitple values was supplied where a single value was expected."
Hey gmasta1129 ,
I assume you receive the error because lookupvalue finds more than matching row.
Either you add more than a single search/value pair to the LOOKUPVALUE function or you replace the function using FILTER in combination with an iterator function like SUMX to aggregate the values
If you need more help, create a pbix that contains sample data, upload the pbix to onedrive or dropbox and share the link.
If you are using Excel to create the sample data instead of the manual input method, share the xlsx as well.
Regards,
Tom