Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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 matrix visual, I include the month and year (MM-YYYY) in the columns, the change is calculated correctly for each month, however, the calculation on the total is not correct. Would you know how to ensure that the total change is from the oldest month to the most recent month in the matrix? Thank you.
Solved! Go to Solution.
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.
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.
Hi @Doorian ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @Doorian ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @johnt75 for the prompt response.
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |