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
Anonymous
Not applicable

Bar chart with 2 values

Hello,

 

I would like to put 2 values in a grouped bar chart. The values are "revenue selected year" and "revenue previous year", grouped in several categories (e.g.: region A, region B, region C).

 

So output should be a grouped bar chart like this:

- region A revenue selected year

- region A revenue previous year

- region B revenue selected year

- region V revenue previous year

- ...

 

Is this possible?

 

Regards

Dennis

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

According to your description, I create this data:

v-yangliu-msft_0-1608782755593.png

Here are the steps you can follow:

1. Create calculated column.

Year = YEAR('Table'[date])

2. Place region to axis, year to legend and revenue to value

v-yangliu-msft_1-1608782755596.jpeg

3. Result:

2020.12.24.111.jpg

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , can you share current setup? if you have both legend and axis they you can have only one measure

Anonymous
Not applicable

Hello @amitchandak ,

 

I do not get how this solves my problem. I do have regions as my axis, but i can just put one measure into values. So it either shows selected year or it shows previous year, what i want to do is but both values in the same bar chart.

amitchandak
Super User
Super User

@Anonymous , Wou can have region as axis and This year vs last year as values/measures using time intelligence and date table 

 

example 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))


//Only year vs Year, not a level below

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
rolling = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]>=max('Date'[Year])-2 && 'Date'[Year]<=max('Date'[Year])) )

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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.