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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anoniem9
New Member

Tooltip percentage not working on line-stacked column chart with defined segment order

Self-taught PowerBi novice here 🙂

 

I'm trying to create a combined line - stacked column chart, showing the absolute number of records within a specific category over time (date from a DIM table on the x-axis). Additionally, I use a tooltip showing the percentage of the segment to the total of the column. 

 

This is the DAX-code I use for the tooltip:

Percentage  =
DIVIDE (
    COUNTROWS('Table1),
    CALCULATE ( COUNTROWS('Table1'), ALLSELECTED ( 'Table1'[Categories] ) )
)

 

Because of the combination of lines and columns, it seemed I couldn't change the order of the segments in the column, so I created a second table to define the order of the segments in the stacked column: 

SegmentSort =
DATATABLE(
  "Segment", STRING,
  "Order", INTEGER,
  {
    {"Category Gr", 1},
    {"Category Kl",    2},
    {"Category Ge",  3}
  }
)

 

In my fact table (Table1), I created the following column:

SegmentOrder = RELATED(SegmentSort[Order])

 

And I created a relation between the Table1 [category] and the SegmentSort[Segment].

 

When I use the tooltip on my graph, it works perfectly. Once I define that my column Table1[category] should be sorted based on Table1[SegmentOrder], all percentages become 100%.

 

What is the reason for this and how can I solve this?

Thanks in advance!

 

1 ACCEPTED SOLUTION
MattiaFratello
Super User
Super User

Hi @Anoniem9

 

try the following:

 

Percentage =
DIVIDE(
COUNTROWS('Table1'),
CALCULATE(COUNTROWS('Table1'), ALLSELECTED('Table1'[category], 'Table1'[SegmentOrder]))
)

 

 


 


If this helped, please mark as Answer and give kudos 👍

View solution in original post

4 REPLIES 4
Rufyda
Super User
Super User


HI @Anoniem9,  I'm glad you found a solution! We're here in the community to support each other.
Regards,
Rufyda Rahma | MIE

Kedar_Pande
Super User
Super User

@Anoniem9 

 

Tooltip Measure:

Percentage = 
DIVIDE(
COUNTROWS('Table1'),
CALCULATE(
COUNTROWS('Table1'),
ALLEXCEPT('Table1', SegmentSort[Order])
)
)

 

If this answer helped, please click 👍 or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande

MattiaFratello
Super User
Super User

Hi @Anoniem9

 

try the following:

 

Percentage =
DIVIDE(
COUNTROWS('Table1'),
CALCULATE(COUNTROWS('Table1'), ALLSELECTED('Table1'[category], 'Table1'[SegmentOrder]))
)

 

 


 


If this helped, please mark as Answer and give kudos 👍

Yes this works! Thank you so much, @MattiaFratello !

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.