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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

Calculate dynamic line for plotting on a line and clustered bar chart

Hi All,

 

I have a many tables and relationships, but to summarize my problem

 

I have a table like below - 

 

ObjectDateCt
AJan-15
AJan-210
AJan-315
AJan-420
BJan-11
BJan-22
BJan-33

 

I have created a simple measure to get the percentage of count for the object - 

 

 

pc_ct = 

var ct_obj = CALCULATE(SUM(Table1[Ct]))

var ct_total_obj = CALCULATE(SUM(Table1[Ct]), REMOVEFILTERS(Table1[Object]))

return ct_obj/ct_total_obj

 

 

And plotted a clustered column chart and added a constant line at 5% using the "Analytics" pane of the visual.

kmpbi_1-1633475670240.png

My goal is to make that constant line dynamic. The logic is :

the constant threshold line should be = to the minimum % value on the bar chart as long its greater than 5%, else should default to 5%.

For example -

in this chart, it should show at 11%. 

As another example,
If the % ct is say 3%, the constant threshold line should show 5%

 

In my original data, I have many objects and many filters to slice the data.
I am happy to switch to a line and cluster column chart visual, but I am not sure how to write the DAX measure to get that dynamic constant line.

 

Any help in this regard would be highly appriciated.

regards

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , based on what I got , create a measure and use that in constant line (with new fx option in new release)

 

measure = minx(Values(Table[object]), [pc_ct])

 

 

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , based on what I got , create a measure and use that in constant line (with new fx option in new release)

 

measure = minx(Values(Table[object]), [pc_ct])

 

 

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

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors