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
I have a slicer on the page which filters it by portfolio code ex: 54321, 12332, 23421 etc. Does this need to be added to the lookup? And if so, how would that be done?
- TomMartens4 years agoSuper User
Hey gmasta1129 ,
please be aware that caculated columns will be only "calculated" during data refresh and design time.
Here you will find more information about the LOOKUPVALUE function: https://dax.guide/lookupvalue/
What it makes more difficult to provide further help is the fact that the data from your original post does not contain a column portfolio code.
Provide a Power BI file that contains sample data but still reflects your data model (tables, relationships, calculated columns, and. measures). Upload the file onedrive or dropbox and share the link in this thread.
Regards,
Tom