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
Anonymous
Not applicable

calculate difference in score from previous score for multiple customers

Hi,

 

I want to create the % change column by taking the difference of the last score for each 'Dm Site Name' to previous score. This could be done by TaskCreatedOn or TaskID. Please help!

 

TaskIDDm Site NameTaskCreatedOnStatusNameTotal %Change
111Headquarters A10/7/19Completed (remediation identified)73% - 
222Flagship A10/7/19Completed (no remediation)89% - 
333Flagship A12/7/19Completed (remediation identified)88%-1%
444Headquarters A11/11/19Completed (no remediation)72%-1%
555Headquarters A2/24/20In Progress75%3%
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

So maybe:

 

Column =
  VAR __SiteName = [Dim Site Name]
  VAR __PreviousID = 
    MAXX(
      FILTER(
        'Table',
        [TaskID] < EARLIER([TaskID]) &&
          [Dim Site Name] = __SiteName
      ),
      [TaskID]
    )
  VAR __PreviousTotal = 
    MAXX(
      FILTER(
        'Table',
        [TaskID = __PreviousID &&
          [Dim Site Name] = __SiteName
      ),
      [Total %]
    )
RETURN
  [Total %] - __PreviousTotal


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

So maybe:

 

Column =
  VAR __SiteName = [Dim Site Name]
  VAR __PreviousID = 
    MAXX(
      FILTER(
        'Table',
        [TaskID] < EARLIER([TaskID]) &&
          [Dim Site Name] = __SiteName
      ),
      [TaskID]
    )
  VAR __PreviousTotal = 
    MAXX(
      FILTER(
        'Table',
        [TaskID = __PreviousID &&
          [Dim Site Name] = __SiteName
      ),
      [Total %]
    )
RETURN
  [Total %] - __PreviousTotal


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.