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
RichOB
Post Patron
Post Patron

calculating % from previous months value

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

TypeDateID
Incident01/04/20241
Incident01/04/20242
Incident01/04/20243
Incident01/05/20244
Incident01/06/20245
Incident01/06/20246
Incident01/06/20247
Incident01/06/20248
Incident01/07/20249
Incident01/07/202410

 

TypeDate CountPrev_Month% Difference
Incident01/04/20243  
Incident01/05/202413200%
Incident01/06/202441-75%
Incident01/07/202424100%

 

This was my measure, but for some reason, it was coming up as the same as the current month.

Prev_Month = CALCULATE(DISTINCTCOUNT(Table[ID]), DATEADD(Table[Date].[Date], -1, MONTH))


Thanks!

1 ACCEPTED SOLUTION
v-sathmakuri
Community Support
Community Support

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.

 

Incident Count = DISTINCTCOUNT('Table'[ID])
 
user the below measure to get the count of previous month count
 
Prev_Month =
CALCULATE(
    DISTINCTCOUNT('Table'[ID]),
    DATEADD('Table'[Date], -1, MONTH)
)

 

Use below measure to get %difference.

 

% Difference =
IF (
    ISBLANK([Prev_Month]),
    BLANK(),
    DIVIDE(
        [Prev_Month] -[Incident Count],
        [Incident Count],
        BLANK()
    ) * 100
)
 
I got the expected results using above measures. Attached the Pbix file for reference.
  

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!!

View solution in original post

7 REPLIES 7
v-sathmakuri
Community Support
Community Support

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!!

v-sathmakuri
Community Support
Community Support

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!!

v-sathmakuri
Community Support
Community Support

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!!

v-sathmakuri
Community Support
Community Support

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.

 

Incident Count = DISTINCTCOUNT('Table'[ID])
 
user the below measure to get the count of previous month count
 
Prev_Month =
CALCULATE(
    DISTINCTCOUNT('Table'[ID]),
    DATEADD('Table'[Date], -1, MONTH)
)

 

Use below measure to get %difference.

 

% Difference =
IF (
    ISBLANK([Prev_Month]),
    BLANK(),
    DIVIDE(
        [Prev_Month] -[Incident Count],
        [Incident Count],
        BLANK()
    ) * 100
)
 
I got the expected results using above measures. Attached the Pbix file for reference.
  

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!!

pankajnamekar25
Super User
Super User

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

Prev_month.png

could you pls provide your pbix file or some sample data?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors