Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi, I'm fairly new to Power BI and DAX. I would very much appreciate the help. Thanks in advance.
I have a database with accidents and incidents, the location where they happened, the month they happened and the reference. I’m trying to calculate the variance in the same way as I do in excel. In excel the grand total is the number of times a location is counted in the data in the current month. A separate tab counts the location listed in the previous month. Variance is then calculated by subtracting the previous month from the current month.
In PowerBI the location is counted by counting the reference (string value) per location. I’ve tried to make measures for the count per location in the current month and the previous month and another measure for the difference (variance). Unfortunately it takes the total and shows that for every location.
I’ve made the following measures:
Count_reference = COUNT('Data'[Reference])
current month = CALCULATE ([Count_reference], FILTER (ALL ('Data'), 'Data'[Event Month]= DATE (YEAR (TODAY ()), MONTH (TODAY ())-2, 1)))
previous month = CALCULATE ([Count_reference], FILTER (ALL ('Data'), 'Data'[Event Month]= DATE (YEAR (TODAY ()), MONTH (TODAY ())-3, 1)))
monthly variance = [current month]-[previous month]
Is there a way to calculate the variance per location in this specific set of circumstances?
Please find the excel file here:
Solved! Go to Solution.
pls see the attachment below
Proud to be a Super User!
which sheet do you want to recreate in PBI?
Proud to be a Super User!
The sheet called "Month Sub Type by Service", specifically column N the Variance prev month
The variance is found in the excel file in the tab called "Month Sub Type by Service" column N.
pls see the attachment below
Proud to be a Super User!
Amazing, thank you so much!
you are welcome
Proud to be a Super User!
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 23 | |
| 20 | |
| 18 | |
| 14 |
| User | Count |
|---|---|
| 58 | |
| 51 | |
| 41 | |
| 30 | |
| 24 |