Forum Discussion
Doorian
1 year agoNew Member
DAX Measure
Hello everyone, I am looking for help regarding a DAX measure in a matrix visual. I want to calculate the change of my initial measure (number of trips per day) compared to the previous month. In my ...
- 1 year ago
You can try
Month on Month change = IF ( ISINSCOPE ( 'Date'[Year month] ), VAR CurrentValue = [Num trips] VAR PrevValue = CALCULATE ( [Num trips], DATEADD ( 'Date'[Date], -1, MONTH ) ) VAR Result = CurrentValue - PrevValue RETURN Result, VAR MinDate = MINX ( ALLSELECTED ( 'Date'[Year month sort column] ), 'Date'[Year month sort column] ) VAR MaxDate = MAXX ( ALLSELECTED ( 'Date'[Year month sort column] ), 'Date'[Year month sort column] ) VAR CurrentValue = CALCULATE ( [Num trips], 'Date'[Year month sort column] = MaxDate ) VAR PrevValue = CALCULATE ( [Num trips], 'Date'[Year month sort column] = MinDate ) VAR Result = CurrentValue - PrevValue RETURN Result )Its important to use the column which year month is sorted by, rather than the year month column itself, as MIN / MAX won't work properly with alphanumeric columns. If your year month column is actually date which is just formatted in year month format then you can use that column.
v-venuppu
1 year agoCommunity Support
Hi Doorian ,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.
Thank you.