Forum Discussion
sohaibnomani
4 years agoHelper II
Creating a Measure Start date, End date, duration
I have the following two tables, along with a Calender Table consisting of 30 calender dates (starting from 11/3/22 to 4/4/22)) with day no. (1,2,3,4,5). I have already created relationship between s...
- 4 years ago
sohaibnomani use the following measure
Measure = SUMX ( SUMMARIZE ( ADDCOLUMNS ( FILTER ( CROSSJOIN ( 'calendar', _fact ), _fact[Start Date] <= 'calendar'[Date] && _fact[End Date] >= 'calendar'[Date] ), "sum", CALCULATE ( SUM ( _dimension[Manpower] ), TREATAS ( { CALCULATE ( MAX ( _fact[Team] ) ) }, _dimension[Team] ) ) ), [Date], [Team], [sum] ), [sum] )
smpa01
4 years agoCommunity Champion
sohaibnomani What is required is that the chart on x axis plotes all dates and show the sum of manpower on each date - The given dataset does not have Manpower by Date anywhere in the data? Can you revise your data?
sohaibnomani
4 years agoHelper II
The fact table contains start date and end date. All the dates in between would have the same team (MA, EA, EB) while manpower is mentioned in the dimension table.
- smpa014 years agoCommunity Champion
sohaibnomani based on the dataset that you provided what was the output you desired?
- sohaibnomani4 years agoHelper II
this result. on 14th EA and EB teams are also working so total count is 46
Date Manpower 11/03/2021 21 12/03/2021 21 13/03/2021 21 14/03/2021 46 15/03/2021 21 16/03/2021 21 17/03/2021 21 18/03/2021 21 19/03/2021 21 20/03/2021 21 21/03/2021 21 22/03/2021 21 23/03/2021 21 24/03/2021 21 25/03/2021 21 - smpa014 years agoCommunity Champion
sohaibnomani use the following measure
Measure = SUMX ( SUMMARIZE ( ADDCOLUMNS ( FILTER ( CROSSJOIN ( 'calendar', _fact ), _fact[Start Date] <= 'calendar'[Date] && _fact[End Date] >= 'calendar'[Date] ), "sum", CALCULATE ( SUM ( _dimension[Manpower] ), TREATAS ( { CALCULATE ( MAX ( _fact[Team] ) ) }, _dimension[Team] ) ) ), [Date], [Team], [sum] ), [sum] )