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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
E_K_
Helper III
Helper III

Calculate % change in [ID] where the user can input the starting month to compare to.

Want to calculate the % change in distinct count of [ID] per month, where the user can pick the starting month. the date column is [Start Time] which contains date time values, both columns are in the table 'Incidents'.

 

What I currently have (that only produces blanks, even if I filter on month.

 

Does the measure work and I need some selector visual to input the start month to compare to, or does the dax code need fixing too?

% Change =
VAR SelectedMonth = SELECTEDVALUE('Incidents'[Start Time])
VAR StartMonth = CALCULATE(
    FIRSTNONBLANK('Incidents'[Start Time], MAX('Incidents'[ID])),
    FILTER('Incidents', MONTH('Incidents'[Start Time]) < SelectedMonth)
)
VAR StartValue = CALCULATE(
    DISTINCTCOUNT('Incidents'[ID]),
    MONTH('Incidents'[Start Time]) = MONTH(StartMonth)
)
VAR EndValue = CALCULATE(
    DISTINCTCOUNT('Incidents'[ID]),
    MONTH('Incidents'[Start Time]) = SelectedMonth
)

RETURN DIVIDE(EndValue - StartValue, StartValue) * 100

 

2 REPLIES 2
amitchandak
Super User
Super User

@E_K_ , You should use date table and time intelligence

 

examples

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]))
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]))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

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

@amitchandak  this clearly does not fit my use case. You are suggesting TD measures which are not what I am after

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors