other
218 TopicsLine Segment and Legend Color Based on Measures
Conditional formatting in Power BI just got a solid upgrade. In the July 2026 update, conditional formatting now works on Line Charts and visuals with Legends. This was one of the most requested features. It lets you apply data-driven colors across multiple visual types and keep colors consistent throughout your reports. Up until recently, when I used to interview Power BI professionals with a lot of experience in visualization, I had a good way to test them. I'd ask one of these questions: Which visuals don't support conditional formatting? I made some changes to my visual and now the conditional formatting option isn't showing. Why? How do you apply conditional formatting on Line and Pie visuals? It was an easy way to catch gaps. Conditional formatting wasn't supported on legends. For Pie visuals, the workaround was to apply it on a Bar chart first and then switch to Pie. For Line visuals, we used to get extra color markers the same way. Power BI has been improving its visualization experience steadily over the last two years, with big updates coming regularly. This long-awaited feature finally made it into the July 2026 update. Conditional formatting is now supported on Line visuals and Legends. Why it was needed on Line visuals Just like any other visual, you sometimes need line segments to change color based on a condition. This helps explain things like margins going down or current year vs previous year comparisons. Why it was needed on Legends Say your company always uses one color and your competitor uses another. On a report showing market share, you'd always want your company represented by the same color. That was possible for axis values but not for legends. This update fixes that. You can now apply conditional formatting on Pie, Stacked, and any other visual that uses a legend. Please find the file where I have used different measures to do conditional formatting on Line and Legends Measure used Brand Color = SWITCH ( TRUE (), Max('Item'[Brand])= "Brand 1", "Yellow", Max('Item'[Brand])= "Brand 2", "Green", Max('Item'[Brand])= "Brand 3", "Blue", Max('Item'[Brand])= "Brand 4", "Red", Max('Item'[Brand])= "Brand 5", "Orange", Max('Item'[Brand])= "Brand 6", "Purple", Max('Item'[Brand])= "Brand 7", "Pink", Max('Item'[Brand])= "Brand 8", "Cyan", Max('Item'[Brand])= "Brand 9", "Lime", Max('Item'[Brand])= "Brand 10", "Brown", Max('Item'[Brand])= "Brand 11", "Gray", Max('Item'[Brand])= "Brand 12", "Teal", Max('Item'[Brand])= "Brand 13", "Magenta", "Other" ) Category Measure Category Color = SWITCH ( TRUE (), Max('Item'[Category] )= "Category 1", "Red", Max('Item'[Category] )= "Category 2", "Green", Max('Item'[Category] )= "Category 3", "Blue", Max('Item'[Category] )= "Category 4", "Yellow", Max('Item'[Category] )= "Category 5", "Orange", "Black" ) Color Year Max Year = max('Date'[Year]) You can also check the video on the same - https://www.youtube.com/watch?v=SDX1gUpcJaw&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=148Views0likes0CommentsGreeting
Create a personalized greeting for your users with this Quick Measure. Uses USERNAME function so that doesn't work so well with Publish To Web. Greeting = VAR user = USERNAME() VAR hour = HOUR(NOW()) VAR minute = MINUTE(NOW()) VAR prefix = SWITCH( TRUE(), hour<12,"Good morning ", hour<17,"Good afternoon ", "Good evening " ) RETURN CONCATENATE(prefix,user) Place this measure in a Card visualization. If you have a lookup table of user names and friendly display names, you can do this: Greeting1 = VAR user = USERNAME() VAR display = LOOKUPVALUE(Table1[User],Table1[Email],user) VAR display1 = IF(ISBLANK(display),"Player One", display) VAR hour = HOUR(NOW()) VAR minute = MINUTE(NOW()) VAR prefix = SWITCH( TRUE(), hour<12,"Good morning ", hour>=12 && hour<17,"Good afternoon ", "Good evening " ) RETURN CONCATENATE(prefix,display1) eyJrIjoiMjNiMmYxMWQtMDc2OC00ZGY0LWE4NDctZWFlMWU3MjExNzQ4IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN97.7KViews2likes3CommentsQUARTILE.EXC
In my recent quest to create or catalog as many DAX equivalents for Excel functions, this just adds to the struggles with Excel's QUARTILE function. So, in numerous locations, such as this; not that...God forbid, Quora is authoritative about anything, but in mulitiple places there are two documented methods of calculating 1st and 3rd quartiles and they all seem to essentially agree about the general nature of those two methods. So I implemented the exclusive method here but the results seem to come out to more along the lines of the inclusive method, not that I trust Excel's calculations of those either. So, who knows at this point. Here it is though. QUARTILE.EXC = VAR __Values = SELECTCOLUMNS('Table',"Values",[Column1]) VAR __Quart = MAX('Quartiles'[Quart]) VAR __Median = MEDIANX(__Values,[Values]) VAR __Count = COUNTROWS(__Values) VAR __Quartile = SWITCH(__Quart, 0,MINX(__Values,[Values]), 2,__Median, 4,MAXX(__Values,[Values]), 1, VAR __Median = IF( ISEVEN(__Count), MEDIANX(FILTER(__Values,[Values] < __Median),[Values]), MEDIANX(FILTER(__Values,[Values] <= __Median),[Values]) ) RETURN __Median, 3, VAR __Median = IF( ISEVEN(__Count), MEDIANX(FILTER(__Values,[Values] > __Median),[Values]), MEDIANX(FILTER(__Values,[Values] >= __Median),[Values]) ) RETURN __Median ) RETURN __Quartile All I can say is that apparently either everyone else in the entire world (as far as I can find) is wrong about how to calculate quartiles or...maybe I am missing something. Something else that bugs me, all of the documentation on QUARTILE.INC, QUARTILE.EXC, PERCENTILE.INC, PERCENTILE.EXC all focus on the "inclusive/exclusive" part about the kth values from 0..1. Except that seems like the least important part to me because there are clearly different methods going on here in terms of how these functions compute the quartiles/percentiles because you can get very different answers, especially when dealing with even numbers of items. The fact that you can't use 0 and 1 in one of them seems like the last thing that you would want to explain but rather explain why the calculated values are different? And another thing with regard to the "interpolation", apparently that is why the numbers generated for the 1st and 3rd quartiles in Excel varies from the way everybody else does it so how exactly is this interpolation happening and why is it better or worse than the way everyone else seems to do it? eyJrIjoiNzQxZTc1ZDgtMmE2Ni00NDE0LWExNjktZWJiMzBhZTk3Y2UyIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN926KViews0likes6CommentsDIY SVG Progress Bar
DIY Tool: https://app.powerbi.com/view?r=eyJrIjoiNjdmMWM0ODAtMTgyZC00Y2ZkLWIxZTctMjI4YjNlNzk4OTU4IiwidCI6IjI5Y2JkNTY4LTBlOWItNDQ0Zi1iZTA1LTYxNjMyOTAzNjJmZSJ9 eyJrIjoiNjdmMWM0ODAtMTgyZC00Y2ZkLWIxZTctMjI4YjNlNzk4OTU4IiwidCI6IjI5Y2JkNTY4LTBlOWItNDQ0Zi1iZTA1LTYxNjMyOTAzNjJmZSJ95.1KViews0likes0CommentsDIY SVG Icon Bar For Table or Matrix
How to use? link https://app.powerbi.com/view?r=eyJrIjoiZDE4NmYwMTQtMzFiZi00MGM0LTgyODAtODk3MTkxZTBiODU2IiwidCI6IjI5Y2JkNTY4LTBlOWItNDQ0Zi1iZTA1LTYxNjMyOTAzNjJmZSJ9 eyJrIjoiZDE4NmYwMTQtMzFiZi00MGM0LTgyODAtODk3MTkxZTBiODU2IiwidCI6IjI5Y2JkNTY4LTBlOWItNDQ0Zi1iZTA1LTYxNjMyOTAzNjJmZSJ94.9KViews0likes0CommentsDIY SVG Waffle Charts
Search & Choose an icon, then copy the SVG Measure below. https://app.powerbi.com/view?r=eyJrIjoiM2EwYjEwNDAtZTAyNS00NGFmLWE3YmUtNWYwNTBmMWFhNTY3IiwidCI6IjI5Y2JkNTY4LTBlOWItNDQ0Zi1iZTA1LTYxNjMyOTAzNjJmZSJ9 eyJrIjoiM2EwYjEwNDAtZTAyNS00NGFmLWE3YmUtNWYwNTBmMWFhNTY3IiwidCI6IjI5Y2JkNTY4LTBlOWItNDQ0Zi1iZTA1LTYxNjMyOTAzNjJmZSJ95KViews0likes0CommentsMap Lines
Came out of this conversation: Create Origin To Destination Map In BI Desktop - Microsoft Fabric Community. Here's a way to create origin to destination lines on a map given a table of cities. CityLatitudeLongitude Columbus, OH 39.9611111 -82.9988889 London, UK 51.5 -0.116667 Kansas City 39.099912 -94.581213 St. Louis 38.627089 -90.200203 From and To = VAR __NumSteps = 100 VAR __Steps = SELECTCOLUMNS( GENERATESERIES( 1, __NumSteps, 1 ), "Step", [Value] ) VAR __BaseTable = FILTER( GENERATE( SELECTCOLUMNS( 'Cities', "From City", [City], "From Long", [Longitude], "From Lat", [Latitude] ), SELECTCOLUMNS( 'Cities', "To City", [City], "To Long", [Longitude], "To Lat", [Latitude] ) ), [From City] <> [To City] ) VAR __String = CONCATENATEX( __BaseTable, [From City] & "^" & [From Long] & "^" & [From Lat] & "^" & [To City] & "^" & [To Long] & "^" & [To Lat], "|" ) VAR __Count = COUNTROWS( __BaseTable ) VAR __Table = ADDCOLUMNS( GENERATESERIES( 1, __Count ), "__Data", SUBSTITUTE( PATHITEM( __String, [Value] ), "^", "|" ) ) VAR __Result = FILTER( SELECTCOLUMNS( ADDCOLUMNS( GENERATE( __Table, __Steps ), "Latitude", PATHITEM( [__Data], 3 ) + ( [Step] / __NumSteps ) * ( PATHITEM( [__Data], 6 ) - PATHITEM( [__Data], 3 ) ), "Longitude", PATHITEM( [__Data], 2 ) + ( [Step] / __NumSteps) * ( PATHITEM( [__Data], 5 ) - PATHITEM( [__Data], 2 ) ) ), "Latitude", [Latitude], "Longitude", [Longitude], "From", PATHITEM( [__Data], 1 ), "To", PATHITEM( [__Data], 4 ) ), [From] <> [To] ) RETURN __Result eyJrIjoiMDZkNjhlMmItZTg1ZC00ZmM2LTkwZTEtNDJiZDA3ZGFlNDRjIiwidCI6Ijg3NDlmOWI5LWYzMmQtNDdhMS1hMjI0LTM2OTQxOGFlMmY1MSJ97.5KViews3likes1CommentMAGIC!
This is my 150th Quick Measure! I wanted to make it extra special. You can read all about the creation of it here. The short form is that this combines an advanced machine learning model that uses the entire history of the Power BI forums to find solutions to questions posed within a modified Q&A visualization coupled with a custom visualization and advanced DAX to return the solution returned by the machine learning model. Because this solution includes new Power BI features that are not yet available generally, Microsoft has requested that I do not post the PBIX file. And it wouldn't work anyway with any current publicly available version of Power BI Desktop anyway. Try it out!! eyJrIjoiZDhjYjBhMWItM2YwYS00NzliLWFiNmMtZThiOWQxM2M1MDg1IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN95.9KViews8likes0Comments