Forum Discussion

bcz's avatar
bcz
New Member
4 years ago
Solved

Reducing a value over time

hey all, i am super new to power bi and have to create a report for management that i am stuck with.

Basically i have a count of total migrations that reduces over time as we do more (see screenshot). I just want the number of migrations we do on a given day to be subtracted from the total number and that number becomes my new total for the next days. sorry i even have trouble describing it but the picture should show what i want to do.

 

 

  • Hi bcz ,

     

    How about this:

     

    Here the DAX:

    MigrationLeft = 
    VAR _currentDate = 'Table'[Date]
    RETURN 
    MAX ( 'Table'[MigrationTotal] ) - CALCULATE ( SUM ( Table[Migration] ), ALL('Table'), 'Table'[Date] <= _currentDate )

     

    Note, MAX ( 'Table'[MigrationTotal] ) is the way I retrieved the Total of migration. You might get that value from a measure or in another way πŸ™‚

    Let me know if something is unclear...

     

    /Tom
    https://www.tackytech.blog/
    https://www.instagram.com/tackytechtom/

     

2 Replies

  • tackytechtom's avatar
    tackytechtom
    Most Valuable Professional

    Hi bcz ,

     

    How about this:

     

    Here the DAX:

    MigrationLeft = 
    VAR _currentDate = 'Table'[Date]
    RETURN 
    MAX ( 'Table'[MigrationTotal] ) - CALCULATE ( SUM ( Table[Migration] ), ALL('Table'), 'Table'[Date] <= _currentDate )

     

    Note, MAX ( 'Table'[MigrationTotal] ) is the way I retrieved the Total of migration. You might get that value from a measure or in another way πŸ™‚

    Let me know if something is unclear...

     

    /Tom
    https://www.tackytech.blog/
    https://www.instagram.com/tackytechtom/

     

    • bcz's avatar
      bcz
      New Member

      this worked like a charm. thanks so much!