Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Converting stages with dates into a timeline chart.

I have some data which looks like the following: 

 

 image.png

 

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.

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Anonymous

 

Here is one approach - uploaded pbix here.

 

  1. Transform your Ideas table into this form:image.png

     

  2. Create a disconnected 'Date' table

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

  4. Stacked column visual looks like this - I think you wanted something similar:image.png

     

Is that the sort of thing you were looking for?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
OwenAuger
Super User
Super User

Hi @Anonymous

 

Here is one approach - uploaded pbix here.

 

  1. Transform your Ideas table into this form:image.png

     

  2. Create a disconnected 'Date' table

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

  4. Stacked column visual looks like this - I think you wanted something similar:image.png

     

Is that the sort of thing you were looking for?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not 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? 

 

 

@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


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.