The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, I need a column that displays the previous month's incident figures in the same row as the current month so that I can calculate the percentage difference by month. However, for some reason, my measure is not working.
Here is my table
Type | Date | ID |
Incident | 01/04/2024 | 1 |
Incident | 01/04/2024 | 2 |
Incident | 01/04/2024 | 3 |
Incident | 01/05/2024 | 4 |
Incident | 01/06/2024 | 5 |
Incident | 01/06/2024 | 6 |
Incident | 01/06/2024 | 7 |
Incident | 01/06/2024 | 8 |
Incident | 01/07/2024 | 9 |
Incident | 01/07/2024 | 10 |
Type | Date | Count | Prev_Month | % Difference |
Incident | 01/04/2024 | 3 | ||
Incident | 01/05/2024 | 1 | 3 | 200% |
Incident | 01/06/2024 | 4 | 1 | -75% |
Incident | 01/07/2024 | 2 | 4 | 100% |
This was my measure, but for some reason, it was coming up as the same as the current month.
Thanks!
Solved! Go to Solution.
Hi @RichOB ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @pankajnamekar25 for the prompt response.
Create the below measure to get the count of incidents.
Use below measure to get %difference.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Hi @RichOB ,
I hope the information provided is helpful. Feel free to reach out if you have any further questions or would like to discuss this in more detail. If responses provided answers your question, please accept it as a solution so other community members with similar problems can find a solution faster.
Thank you!!
Hi @RichOB ,
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 the responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you!!
Hi @RichOB ,
May I ask if the provided solution helped in resolving the 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!!
Hi @RichOB ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @pankajnamekar25 for the prompt response.
Create the below measure to get the count of incidents.
Use below measure to get %difference.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Hello @RichOB
Here you can try , Make sure you have a calendar table
Prev_Month =
CALCULATE(
DISTINCTCOUNT(Table[ID]),
DATEADD(DateTable[Date], -1, MONTH)
)
CurrentMonth = DISTINCTCOUNT(Table[ID])
% Difference =
DIVIDE(
[CurrentMonth] - [Prev_Month],
[Prev_Month],
BLANK()
)
Thanks,
Pankaj Namekar | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
Hi @pankajnamekar25, thanks for this. The table is linked to a calendar table and the current month works, but for some reason the previous month is showing as empty. Any ideas why? The measure is exactly what you've provided. Thanks
could you pls provide your pbix file or some sample data?
Proud to be a Super User!