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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Josh1994
Helper II
Helper II

How to display YTD + Target as a seperate column

Hi!

 

I am trying to copy an excel graph into a power bi visual, but am struggling to get the functionality i want.

 

I want a clustered column chart to show monthly information, and then two seperate columns at one side of the graph displaying 2021 data, and the YTD average data for the months.

 

Below I attach screenshot of how i want the graph to look.

 

Josh1994_1-1648122778457.png

 

This is where i currently am

Josh1994_2-1648122830144.png

 

I have the target data, and the last year date as a seperate column in data.


Really appreciate yoru help, please let me know if i am not clear.

 

Thank you


Josh

 

 

 

1 ACCEPTED SOLUTION
Josh1994
Helper II
Helper II

Hi Guys,

 

I ended up solving this by using a column named "sort order" and then sorting the other column by that column.

 

print screen below

 

Josh1994_0-1648635566366.png


thanks for your help!

 

 

View solution in original post

3 REPLIES 3
Josh1994
Helper II
Helper II

Hi Guys,

 

I ended up solving this by using a column named "sort order" and then sorting the other column by that column.

 

print screen below

 

Josh1994_0-1648635566366.png


thanks for your help!

 

 

Anonymous
Not applicable

Hi @Josh1994 ,

 

It seems that there are additional two values for X-axis except all Months, right?

 

If so, you need to create a new table for X-axis values:

For X-axis = 
var _t1=ADDCOLUMNS( VALUES('Table'[Date].[Month]),"Index",MONTH( CONVERT([Date].[Month] &" 1",DATETIME)))
return UNION(_t1,ROW("Month","YTD","Index",13), ROW("Month",MAX('Table'[Date].[Year])-2 ,"Index",14) )

Sort values by Index column:

Eyelyn9_0-1648519674299.png

 

Then create a measure to match each "Month":

Measure = 
var _SumofMonth=CALCULATE(SUM('Table'[Value]),FILTER('Table',MONTH([Date])=MAX('For X-axis'[Index]) && YEAR([Date])=MAXX(ALL('Table'[Date]),YEAR([Date])) ))
RETURN 
SWITCH(MAX('For X-axis'[Month]),"YTD",[YTD],"2020",[Two years before],_SumofMonth)

Output:

Eyelyn9_1-1648519791595.png

 

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

Greg_Deckler
Community Champion
Community Champion

@Josh1994 Seems like  you would need a disconnected table with the categories you want in your axis and then a measure that looks at what category it is in and returns the correct value. 

 

Here is an example of the Disconnected Table Trick: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors