Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Count Rows Range of Years

Hello,   I'm trying to use my data to create some different pie charts and bar graphs.   My data set consists of the years 2009 through 2020. The data of interest is strains of a virus, and how m...
  • Syndicate_Admin's avatar
    Syndicate_Admin
    3 years ago

    Hello again

    Sorry if you didn't explain me better,

    IF(YEAR(Calendar[Date]) >= 2015 && YEAR(Calendar[Date]) <= 2020, "True","False")

    "Calendar" you must change it to the name of the database, "Date" should change it to the column where you have specified the year.

    As I have seen in the capture of the other message that you have answered you have the column called "Year" and you only have the year indicated, so you should change the calculated columns that I told you before as follows:

    2009 a 2014:
    Rango2009-2014 = IF("Nombre_Base_Datos"[Año] >= 2009 && "Nombre_Base_Datos"[Año] <= 2014, "True","False")

    2015-2020:
    Range2015-2020 = IF"Nombre_Base_Datos"[Year] >= 2015 && "Nombre_Base_Datos"[Year] <= 2020, "True","False")

    I will attach a couple of screenshots indicating how to create the calculated columns to make everything clearer.

    I've replicated the example you've posted to try to help you as much as possible.


    I hope it has become clearer and if it has helped you do not forget to score!

    Greetings,
    Esteban




  • vanessafvg's avatar
    vanessafvg
    3 years ago

    there a variety of ways you can do this.  Pie charts are not that easy to do comparisons, either clustered or stacked bar charts are easier.    If you decide to use the 2 pie charts, you need to filter the group-range calculated column in the filter pane to select the group you want in that chart.

    filter pane 

     

    i re attach the file with the visuals in them, and yes this is the same calculated column i created with the count measure