Forum Discussion

paulthangaraj's avatar
paulthangaraj
Regular Visitor
6 years ago

Line Chart (Revenue over Years)

Dear all,

 

Greetings, i have been creating this Power BI Report with the following Columns

Project Start YearProject nameRegionRevenue Current YearNext Yearin Two years
2015AAAPAC3.3b1.2b4.5b
2015ABMEA2.5b5.3b0b
2019AVEUROPE1.5b3.6b3.3b
2020AGAPAC1.1b2.2b5.3b
2021AGEurope0.0b3.3b3.3b
2020BHMEA3.23.61.2
2025DGEurope0.0b7.4b3.3b

 

I like to generate a line chart as follows.
line chart (Revenue)

No idea on how to generate one. I have the table as shown in the table above.

Thank you all 🙂

Looking forward for some guidance. 




4 Replies

  • hi paulthangaraj ,

     

    Create a column in your data as follows:

     

    Year Group = IF([Project Start Year] = YEAR(TODAY()), "Current Year",
                               IF([Project Start Year] < YEAR(TODAY()), "Previous Year", "Next Year"))

     

    Create a line chart.

    Move Year Group  to the axis area, Region column to legend area and move your sumaarised value or a calculation to Values area.

     

    Thanks,

    Pragati

                                  

    • paulthangaraj's avatar
      paulthangaraj
      Regular Visitor

      Thank you for the reply,
      there is a little misunderstanding i guess.

      I am using the start year in the report to select. But it does not matter if this is current year or an year later.
      Current year is always 2020 for now 

      in the table i have just the values for the current year and i want the chart to show exactly as current year as mentioned not as 2020 or 2021.



  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    paulthangaraj - You will want to create a disconnected table using an Enter Data query that contains the values in your axis. Then you create a measure that does a MAX on this disconnected table to grab the value in the axis. You can then use this in a SWITCH statement to concoct the desired calculation for that axis point. So, something like:

     

    Measure =
      VAR __AxisValue = MAX('Table'[Value]) // this is your Enter Data disconnected table
    RETURN
      SWITCH(__AxisValue,
        "Current Year",SUMX(FILTER('DataTable',[Project Start Year] = YEAR(TODAY())),[Revenue Current Year]),
        "Next Year",SUMX(FILTER('DataTable',[Project Start Year] = YEAR(TODAY())),[Next Year]),
        "in Two years",SUMX(FILTER('DataTable',[Project Start Year] = YEAR(TODAY())),[in Two Years])
      )
    
    

    That's one way. The other way would be to unpivot your last three columns in Power Query. That would probably be preferred. Then you don't need the measure or disconnected table and it is dirt simple.

    • paulthangaraj's avatar
      paulthangaraj
      Regular Visitor

      I have pivoted all the three columns but to get the values in the VAlue all the three is not possible, How to do that ? Here is the screenshot.