DAX Workout 018 - Challenge: Cleaning up a Line Graph

Challenge: Cleaning up a Line Graph

In this next challenge, you have the life expectancy of all countries from 1950-2020. You can see the graph on the right is an awful mess.

Your mission if you choose to accept, is to untangle this mess so that the end user can make some sense out of it.

You will need to create slicers and measures having a list of countries that when the SELECTEDVALUE is chosen, the line for that country is highlighted and all others greyed out.

The main challenge is NOT to have an overlaying of two graphs; one behind the other. And add a nice tooltip for that selected country.

Submission

Load the supplied data file into a new Power BI file, create your solution, and reply to this post. Upload a screenshot of your solution along with the DAX measure. Please format your DAX code and blur it or place it in a hidden section.

Period
This workout will be released on Thursday, May 18, 2023, and will end on Sunday, May 21, 2023. But you can always come back to any of the workouts and solve them.

DAX _18 Life Expectancy.pbix (1.3 MB)
life-expectancy.csv (513.7 KB)

2 Likes

hi paul.
thanks for this challenge. you’ve mentioned that the main challenge is not to have overlaying of two graphs, but I figured it out that to have other lines in grey we must have two graphs over each other. Do you mean there is another way to make other lines fade without dual graphs?
sincerely mahdi safiri

Hi, It must be solution. On Data Visualization last workout is a similar task and there, in the end, I find a solution for how to do it in one chart using Dax. But it looks like @Paul.Gerber complicated the graph a little more :slight_smile: and exactly the same solution does not work here. :frowning:

Great workout this one. I see these overwhelming charts all the time

3 Likes

hi again.
I think I’ve already done this task. all the measures and design process is included in this report. thanks again for this workout, Paul.

2 Likes

Hello everyone and thank you for participating in this workout. Many of you asked how to do this. @BrianJ did an excellent video explaining which inspired me to make this a DAX workout. Which it was!

It is really a brilliant way of fixing these visuals.

Until next time.

2 Likes

@Paul.Gerber - Yes he did a great job explaining it but only has a 4 few lines on that chart which he created a measure for each one. In the dataset for this challenge / workout there are 256 distinct. I don’t think creating all of those measures is feasible. I know there has to be a better way. Which I will eventually figure out.

1 Like
2 Likes

@mbraun I agree. Let me know what you find out. I would be interested. I have thought the same thing…wow that’s a lot of work

IT should be an enhancement - Conditional Formatting of the Line. Definitely should submit that since you can do it with other base visuals.

1 Like

So, is my understanding that this can only be done with a very limited number of items correct? Otherwise the only option left is the two-graph overlay?

@mbraun I think I missed your solution file to this. Did you use two graphs for this? If not, how did you solve for this?

@Hakeem just one graph. I planned on doing this workout this week on Linkedin.

My solution is at the top of this page

1 Like

Nice. I wanted to explore a different way than creating separate measures for each category. I have field parameters inside of my viz. That is why I was wondering what other solutions were available. At any rate, I will be on the lookout for your LinkedIn post.

1 Like

That is what i am working on now. Quite the challenge

@Hakeem - Yes you are correct, I did this with 2 graphs.

Hi,
Please would you have the PBIX file of correction.

Thanks

answer:


DAX Workout No18 MB.pbix (1.4 MB)