Forum Discussion
Converting stages with dates into a timeline chart.
- 7 years ago
Hi Anonymous
Here is one approach - uploaded pbix here.
- Transform your Ideas table into this form:
Create a disconnected 'Date' table
Create this measure:
Idea Count as at Latest Stage = VAR MaxDate = MAX ( 'Date'[Date] ) RETURN CALCULATE ( DISTINCTCOUNT ( Ideas[Idea] ), GENERATE ( VALUES ( Ideas[Idea] ), CALCULATETABLE ( LASTDATE ( Ideas[Date] ), ALLEXCEPT ( Ideas, Ideas[Idea] ), Ideas[Date] <= MaxDate ) ) )This measure creates a filter combining each Idea with its latest Date. When you apply a Stage filter and a 'Date'[Date] filter, you can then count the Ideas for which the filtered Stage(s) are the latest stage as at the latest Date filtered.
- Stacked column visual looks like this - I think you wanted something similar:
Is that the sort of thing you were looking for?
Regards,
Owen
- Transform your Ideas table into this form:
Hi Anonymous
Here is one approach - uploaded pbix here.
- Transform your Ideas table into this form:
Create a disconnected 'Date' table
Create this measure:
Idea Count as at Latest Stage = VAR MaxDate = MAX ( 'Date'[Date] ) RETURN CALCULATE ( DISTINCTCOUNT ( Ideas[Idea] ), GENERATE ( VALUES ( Ideas[Idea] ), CALCULATETABLE ( LASTDATE ( Ideas[Date] ), ALLEXCEPT ( Ideas, Ideas[Idea] ), Ideas[Date] <= MaxDate ) ) )This measure creates a filter combining each Idea with its latest Date. When you apply a Stage filter and a 'Date'[Date] filter, you can then count the Ideas for which the filtered Stage(s) are the latest stage as at the latest Date filtered.
- Stacked column visual looks like this - I think you wanted something similar:
Is that the sort of thing you were looking for?
Regards,
Owen
- Anonymous7 years agoNot applicable
Hey Owen,
This is almost right, unfortunately, if the project goes through two stages on the same date, it doesn't seem to pick the later stage. Instead it counts 1 for both stages. Is there a way to make it only pick the later stage?
- OwenAuger7 years agoSuper User
Anonymous
I see the problem.
I have updated my file with a couple of options for measures that correct for this:
PBIX linkLogic is the same in each, just written slightly differently. There may well be a more elegant way of handling this! :)
Idea Count as at Latest Stage V2 = VAR MaxDate = MAX ( 'Date'[Date] ) RETURN CALCULATE ( DISTINCTCOUNT ( Ideas[Idea] ), KEEPFILTERS ( GENERATE ( GENERATE ( VALUES ( Ideas[Idea] ), CALCULATETABLE ( LASTDATE ( Ideas[Date] ), ALLEXCEPT ( Ideas, Ideas[Idea] ), Ideas[Date] <= MaxDate ) ), CALCULATETABLE ( LASTNONBLANK ( Ideas[Stage], 0 ), ALLEXCEPT ( Ideas, Ideas[Idea], Ideas[Date] ) ) ) ) )Idea Count as at Latest Stage V3 = VAR MaxDate = MAX ( 'Date'[Date] ) RETURN CALCULATE ( DISTINCTCOUNT ( Ideas[Idea] ), KEEPFILTERS ( GENERATE ( VALUES ( Ideas[Idea] ), CALCULATETABLE ( GENERATE ( LASTDATE ( Ideas[Date] ), CALCULATETABLE ( LASTNONBLANK ( Ideas[Stage], 0 ), ALLEXCEPT ( Ideas, Ideas[Idea], Ideas[Date] ) ) ), ALLEXCEPT ( Ideas, Ideas[Idea] ), Ideas[Date] <= MaxDate ) ) ) )Regards,
Owen