Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

calculating dynamic change rate for month and year

hello.. I have aggregated data over year and month

year  month  region  size  value  
20151alarge100
20152alarge90
20153alarge80
20154alarge90
20155alarge80
20156alarge76
20157alarge72
20158alarge68
20159alarge64
201510alarge60
201511alarge56
201512alarge52
20151asmall48
20152asmall44
20153asmall40
20154asmall36
20155asmall32
20156asmall28
20157asmall24
20158asmall20
20159asmall16
201510asmall12
201511asmall8
201512asmall4

I want to calculate value change over a year... also over a month .. dynamically group by the report column that end user will build

e.g.

sizeyearmonthchange rate %

 

regionyearmonthchange rate %

 

sizeyear

change rate %

 

regionyearchange rate %

 

 

can any one help with the dax equation I should use

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Create a date from year and month and then you can use time intelligence with datr table 

Date = Date([year],[month],1)

 

example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
next month Sales = CALCULATE(SUM(Sales[Sales Amount]),nextmonth('Date'[Date]))
this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value =  CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))

diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales])

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Fowmy
Super User
Super User

@Anonymous 

Hope you have a calendar table in your model, if not create one using DAX or Power Query.
Following DAX formula can be used :

 

Sales MoM% = 
VAR __PREV_MONTH = CALCULATE(SUM('Table'[ Value]), DATEADD('Dates'[Date], -1, MONTH))
RETURN
	DIVIDE(SUM('Table'[ Value]) - __PREV_MONTH, __PREV_MONTH)

 

 

 

Sales YoY% = 
VAR __PREV_YEAR = CALCULATE(SUM('Table'[ Value]), DATEADD('Dates'[Date], -1, YEAR))
RETURN
	DIVIDE(SUM('Table'[ Value]) - __PREV_YEAR, __PREV_YEAR)

 

 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn


 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

hello mr fowmy...

 

thank you for you responde,,, but I mentioned that the data is aggregated by month.. so actually I don't have a day to relate with calendar table

@Anonymous 

I am not sure how your data model is built, anyhow can you try the following measure?

Rate % = 
var __Year = SELECTEDVALUE(Table01[year  ]) - 1 return
var __PreYr = 
    CALCULATE(
        SUM(Table01[value  ]), Table01[year  ] = __Year
    )
var __CurrYr =  
        SUM(Table01[value  ])
return
DIVIDE(__CurrYr - __PreYr , __PreYr)

 

It should work for all scenarios. 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.