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
Hi everyone. I've attached some sample data - hoping this is an easy one for someone to solve but it's causing me some issues at the moment.
So, I have a dataset (sample linked below). I am counting using the formula
=calculate(distinctcount('Sample Data 160525'[Event Key]))
The data is plotted onto a graph and I then use the column 'Type' in the Legend of the chart to view both activity and demand on the same chart.
What I need to do is now calculate the difference between activity and demand per month. So, if activity is 10 in May and Demand is 15 in May, the new data needs to show a calculation of the difference of 5. And this needs ot be replicated throughout the data (I have 7 years worth of data in the actual data so I need to be able to calculate this easily).
I also need to be able to show a moving average for the data (activity and demand) and this is going to be used on a separate chart. Can anyone help with this request too? If possible, calculate a 2 month moving average using the linked sample data.
Many thanks all.
Solved! Go to Solution.
You will need to create a calendar table :
https://www.wiseowl.co.uk/power-bi/blogs/power-bi-desktop/power-bi-dates/calendarauto-table/
Join this to your Data Table using the date.
Use the calendar table fields in the visual and the calculations.
If you are happy with this answer please mark as a solution for others to find !
Kudos are always appreciated! Check out our free Power BI video courses.
You could create a measure for each of the 3 calculations and have them in the Y axis and the secondary Y axis.
If you are happy with this answer please mark as a solution for others to find !
Kudos are always appreciated! Check out our free Power BI video courses.
@SamWiseOwl Many thanks. I just wondered if there was an all encomassing way of using a DAX measure to calculate the difference between activity and demand without using activity - demand. I might use it across other fields and it would be far less time consuming if I could just use one measure to calculate the difference every time.
Also - did you also have any ideas around calculating a 2 month moving average on the data? Thanks.
You will need to create a calendar table :
https://www.wiseowl.co.uk/power-bi/blogs/power-bi-desktop/power-bi-dates/calendarauto-table/
Join this to your Data Table using the date.
Use the calendar table fields in the visual and the calculations.
If you are happy with this answer please mark as a solution for others to find !
Kudos are always appreciated! Check out our free Power BI video courses.
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 |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |