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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Addition of multiple measures as target line in bar chart

I have to create a visualisation where on x axis I have 3 categories which has our business ( we are showing the spend amount for all the 3 category) now for example concider i have 3 categories A, B and C. In category A we are spending 80% of our total spend, in category B we have 15% of the total spend and category C has the remaining 5% as its spend value which is being shown on a bar. Now we want to keep the target as: For category A 25% of the total spend should be the target for category A, 70% of the total spend should be the target for category B,and 5% of the total spend should be the target for category C.

 

So, what i want is multiple target values ( target changes for all three category) I have created 3 measure to capture all the targets. Now if I update the target on combo chart (eg: if I have target for category A, it also shows on B and C) if I try to add filter on the category also puts the filter on the total spend amount giving incorrect value. beacuse of which my chart looks like : 

anushaa_0-1696959524045.png

each category target visible for all category type.

Can someone please help me create formula for the target lines and which visualisation would support it. trying to achive a visualisation shown below. where the target value only comes for there category type.

anushaa_0-1696428868018.png

I am using formulas like:

for target value 

A_Tar =
var A = CALCULATE(SUM(Contract[Spend Amt]))

return

A* 0.25
B_Tar =
var B= CALCULATE(SUM(Contract[Spend Amt]))

return

B* 0.70  ----------(Did the same for category C)

 

And to show the target based on the total spend value I also made a measure:

Tot_spend = CALCULATE(SUM(Contract[Spend Amt]))
Also adding a data sample set
Begin DateCategorySpend
3/20/2023A10748
5/30/2023C5259
5/16/2023C62733
7/5/2023A5701
4/11/2023A108120
8/4/2023B103131
3/16/2023A1246.98
4/12/2023A21398
5/16/2023A79695.32
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Create a measure and use that as a line in line clustered bar visual

 

Target =

var _m = calculate([Measure], allselected()) 

return

Switch(Max(Table[Category]) ,

"A", _m*.75 ,

"B", _m*.20 ,

_m*.05

)

 

and use this measure as line , enable marker and use line width =0

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Ritaf1983
Super User
Super User

Hi @Anonymous 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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