Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have some data which looks like the following:
What I want to do is create a chart which will show me how many ideas were in each stage on that particular date.
e.g. on 31/7/2018, we had 2 ideas in stage 2(A,B) and nothing else.
While on 16/9/2018, we had 1 in Stage 3(A), 1 in Stage 2(B), and 2 in Stage 1(C,D)
Is there a way to achieve this dynamically? (i.e. not specifying a date and then using 'countif' to try and figure it out as this is intended to be used as a dynamic dashbard)
The final output will be a stacked column chart with dates along the x axis and counts of the stages on the y axis.
Solved! Go to Solution.
Hi @Anonymous
Here is one approach - uploaded pbix here.
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.
Is that the sort of thing you were looking for?
Regards,
Owen
Hi @Anonymous
Here is one approach - uploaded pbix here.
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.
Is that the sort of thing you were looking for?
Regards,
Owen
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?
@Anonymous
I see the problem.
I have updated my file with a couple of options for measures that correct for this:
PBIX link
Logic 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
User | Count |
---|---|
84 | |
79 | |
69 | |
46 | |
43 |
User | Count |
---|---|
106 | |
50 | |
49 | |
40 | |
39 |