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 - 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:
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.
Solved! Go to Solution.
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
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
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 )
)
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 )
)
@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
)
@renlaforest
Ok Then try
ENTargetToDate =
VAR CrrentDate =
MAX ( EnumDates[Date] )
RETURN
CALCULATE (
SUM ( 'ProjectSetup'[DailyENTarget] ),
REMOVEFILTERS (),
VALUES ( EnumDates[Date] )
EnumDates[Date] <= CrrentDate
)
ENTargetToDate =
VAR CrrentDate =
MAX ( EnumDates[Date] )
RETURN
CALCULATE (
SUM ( 'ProjectSetup'[DailyENTarget] ),
REMOVEFILTERS (),
VALUES ( EnumDates[Date] ),
EnumDates[Date] <= CrrentDate
)
Hi @tamerj1 - sorry it took so long. I think this should work.
https://drive.google.com/file/d/1h24vWpK5mREvPzG1bDXkN94h_5s6qQlX/view?usp=sharing
Can you please share a sample file?
@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
User | Count |
---|---|
20 | |
8 | |
7 | |
7 | |
6 |
User | Count |
---|---|
28 | |
12 | |
12 | |
9 | |
8 |