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
renlaforest
Helper I
Helper I

Cumulative Daily Target

Hi - It's embarassing how many hours I've spent trying to figure this out.

 

My Data Model has a table called Project Setup with project in each row. Each project has a column called Start Date, Close Date, Total Days (close day -start date)+1, and DailyENTarget - the target is different for each project on the list.

 

My table has the daily target listed - this project has a target of 3288 (about 235 per day) and closes on May 11th:

renlaforest_2-1651676525699.png

The dates are based on a table/column called EnumDates[Date] which has a relationship with the other table.

 

I'd like the ENTargetToDate column to show the cumulative target for each day based on the target that's in the data model table and grows incrementaly each day. I have not been able to figure out how to accomplish this.

renlaforest_3-1651676656963.png

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @renlaforest 
Here is the sample file with the solution https://we.tl/t-pHo4kYyRle

ENTargetToDate = 
VAR CrrentDate = MAX ( EnumDates[Date] )
VAR FirstDateInFilter = CALCULATE ( MIN ( EnumDates[Date] ), ALLSELECTED () )
VAR NumberOfDays = DATEDIFF ( FirstDateInFilter, CrrentDate, DAY ) + 1
VAR ProjectTarget = SELECTEDVALUE ( 'ProjectSetup'[DailyENTarget] )
RETURN
    ProjectTarget * NumberOfDays

1.png

View solution in original post

17 REPLIES 17
tamerj1
Super User
Super User

Hi @renlaforest 
Here is the sample file with the solution https://we.tl/t-pHo4kYyRle

ENTargetToDate = 
VAR CrrentDate = MAX ( EnumDates[Date] )
VAR FirstDateInFilter = CALCULATE ( MIN ( EnumDates[Date] ), ALLSELECTED () )
VAR NumberOfDays = DATEDIFF ( FirstDateInFilter, CrrentDate, DAY ) + 1
VAR ProjectTarget = SELECTEDVALUE ( 'ProjectSetup'[DailyENTarget] )
RETURN
    ProjectTarget * NumberOfDays

1.png

tamerj1
Super User
Super User

Hi @renlaforest 

you may try

 

ENTargetToDate =
VAR CrrentDate =
    MAX ( EnumDates[Date] )
RETURN
    CALCULATE (
        SUM ( 'ProjectSetup'[DailyENTarget] ),
        ALLEXCEPT ( 'ProjectSetup', 'ProjectSetup'[ProjectName] ),
        FILTER ( EnumDates, EnumDates[Date] >= CrrentDate )
    )

 

Hi @tamerj1 ,

 

Thank you - I'm still ending up with the same result. I really appreciate your help:

renlaforest_0-1651690759354.png

 

@renlaforest 

I guess I missed something 

ENTargetToDate =
VAR CrrentDate =
    MAX ( EnumDates[Date] )
RETURN
    CALCULATE (
        SUM ( 'ProjectSetup'[DailyENTarget] ),
        ALLEXCEPT ( 'ProjectSetup', 'ProjectSetup'[ProjectName] ),
        REMOVEFILTERS ( EnumDates ),
        FILTER ( EnumDates, EnumDates[Date] >= CrrentDate )
    )

Thank you @tamerj1 ,

 

Unfortunately, I still get the same result.

renlaforest_0-1651756869207.png

 

@renlaforest 
Please try this just to see what results you get

ENTargetToDate =
VAR CrrentDate =
    MAX ( EnumDates[Date] )
RETURN
    CALCULATE (
        SUM ( 'ProjectSetup'[DailyENTarget] ),
        REMOVEFILTERS (),
        EnumDates[Date] <= CrrentDate
    )

Hi @tamerj1 ,

It's now showing the total for 6 days (6*235) - although there are 7 days listed:

renlaforest_0-1651757793828.png

 

@renlaforest 
Ok Then try

ENTargetToDate =
VAR CrrentDate =
    MAX ( EnumDates[Date] )
RETURN
    CALCULATE (
        SUM ( 'ProjectSetup'[DailyENTarget] ),
        REMOVEFILTERS (),
        VALUES ( EnumDates[Date] )
        EnumDates[Date] <= CrrentDate
    )

Hi@tamerj1 - there's an issue with the last EnumDates[Date]

renlaforest_0-1651758528533.png

 

ENTargetToDate =
VAR CrrentDate =
    MAX ( EnumDates[Date] )
RETURN
    CALCULATE (
        SUM ( 'ProjectSetup'[DailyENTarget] ),
        REMOVEFILTERS (),
        VALUES ( EnumDates[Date] ),
        EnumDates[Date] <= CrrentDate
    )

@tamerj1, here is the result:

renlaforest_0-1651768920503.png

Thank you so much for your help with this.

@renlaforest 

Please let me know if you can share sample file?

Hi @tamerj1 - I thought there may be a missing comma, so I added this one, which resulted in:

renlaforest_0-1651758812524.png

 

Can you please share a sample file?

Greg_Deckler
Community Champion
Community Champion

@renlaforest Basically a Running Total measure (there is a Quick Measure for this) but in column form:

ENTargetToDate column =
  VAR __Project = 'Table'[Project] //assumes you have a project column in your tracking table
  VAR __DailyENTarget = MAXX(FILTER('Projects',[Project] = __Project),[DailyENTarget)
  VAR __Date = [Date]
  VAR __Days = COUNTROWS(FILTER(ALL('Table'),[Date] <= __Date))
RETURN
  __Days * __DailyENTarget

  


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

@Greg_DecklerThank you! I'm down to just one issue (I think):

renlaforest_0-1651681593884.png

 

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.