Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Bar chart visualization for different years

Hello!    I believe there should be a rather easy solution for this, but for some reason, I haven't been able to do this I have a list of products with the launching year and the year they will be...
  • AlexisOlson's avatar
    4 years ago

    You'll need a new table to use for the x-axis.

     

    For example:

    Years =
    SELECTCOLUMNS (
        GENERATESERIES ( MIN ( Products[Launched] ), MAX ( Products[Discontinued] ) ),
        "Year", [Value]
    )

    This is just a list of years between 2008 and 2040.

     

    Put Years[Year] on the x-axis and define your counting measures.

    LaunchedCount =
    CALCULATE (
        COUNTROWS ( Products ),
        Products[Launched] IN VALUES ( Years[Year] )
    )
    
    DiscontinuedCount =
    CALCULATE (
        COUNTROWS ( Products ),
        Products[Discontinued] IN VALUES ( Years[Year] )
    )