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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ninsights
Helper III
Helper III

How to Nest Two Fields on the X-axis for a Scatter Plot

In the image below, I have charted employee salary (y-axis value) by the job level (x-axis). 

I have two groups: The orange dots are one group (lt's called them the Orange group) and the second group are the Blue group.

I would like to nest the x-axis so that it shows job level and the group name. Why do I need this? I have no many overlapping dots that I would like to plot the Orange group and blue group separately side by side. So, from left to right my columns of dots would be:

  • Job level 4, Orange Group
  • Job level 4, Blue Group
  • Job Level 5, Orange Group
  • Job Level 5, Blue Group

I know how to do this in Tableau, but not in Power BI. Does anyone know how?

 

Thank you for reading my question.

 

OffsetAxis.jpg

 

 

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @ninsights

 

You can create a measure as:

Measure = 
CALCULATE(
    MAX('Table'[salary]),
    FILTER(
        'Table',
        'Table'[Group]=MAX('Table'[Group]) && 'Table'[Job level]=MAX('Table'[Job level])
    )
)

I used sample data as:

vxulinmstf_0-1628144378923.png

Here is the output:

vxulinmstf_1-1628145404030.png

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

4 REPLIES 4
v-xulin-mstf
Community Support
Community Support

Hi @ninsights

 

You can create a measure as:

Measure = 
CALCULATE(
    MAX('Table'[salary]),
    FILTER(
        'Table',
        'Table'[Group]=MAX('Table'[Group]) && 'Table'[Job level]=MAX('Table'[Job level])
    )
)

I used sample data as:

vxulinmstf_0-1628144378923.png

Here is the output:

vxulinmstf_1-1628145404030.png

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

@v-xulin-mstf : An excellent workaround. Not quite nested but it will do the trick. Thank you very much.

ninsights
Helper III
Helper III

Thank you, @Greg_Deckler . I tried the hierarchy and it wouldn't let me go to the second level. It produced a message about turning all fields to "don't summarize" which is what they were already set to. I think my workaround may be to create a field which will offset the groups around the job level:
If they are orange, subtract 0.1 from the job level; if they are blue, add 0.1 to the job level.

I appreciate your expertise in letting me know the challenges associated with trying to plot a custom hierarchy.

Greg_Deckler
Super User
Super User

@ninsights You can technically put a hiearchy or ad-hoc hierarchy in the X Axis of a scatter chart but I don't believe you can use Details when you do this and you may run into problems. Also, you don't get the drill arrows initially and have to use the options in the Data/Drill tab of the ribbon. And, all of that said, good probability it won't work like you want it to.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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