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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
swapnil_022
New Member

How to compare current year revenue to previous year in gauge chart.

I have a table with Year and Revenue. I want a gauge which compares current year revenue with last years revenue. Table look like following

  

 Year       Revenue

 

 2012       3456788.34

 2013       2345444.54

 2014       2356544.56

 2015       234544.45

 

 How can I do it in power bi?     

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

Hi @swapnil_022,

 

Firstly, from my point of view, gauge chart is not suitable for your scenario, gauge chart is useful when you want to show progress towards a particular target. You’d better create a column chart or bar chart to show revenue difference between different years.

Secondly, create the following columns in your table.

Index = CALCULATE(COUNT(Table3[Year]),ALL(Table3),FILTER(Table3,Table3[Year]<=EARLIER(Table3[Year])))
Difference = Table3[Revenue]-IF(Table3[Index]=1,Table3[Revenue],LOOKUPVALUE(Table3[Revenue],Table3[Index],Table3[Index]-1))

Thirdly, create a column chart as shown in the following screenshot.
1.PNG


However, if you persist to create a gauge chart, use year slicer to filter the gauge chart.
2.PNG


Regards,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Phil_Seamark
Employee
Employee

Hi @swapnil_022

 

If you change your Year data to an actual date, eg 2012-01-01 rather than a number you can use the SAMEPERIODLASTYEAR function to create a measure for you.  But when your data is simply 2012 or 2013, Power BI won't know it's a year.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

How do I convert text to date type. When I tried changing data type it threw an error

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.