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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

How to Color A Scatter Plot Distribution By Date

Hello All.  I'm new to Power BI.

 

I have built a scatter plot distribution chart.  I have a numerical value on the x-axis and a jitter on the y-axis.  I can't figure out (if it's possible) how to color only the dots of a certain day/month/year/etc.  For example, how would I color all the dots red for April 2021?

 

My timestamp is in the details field (made up of a bunch of discrete dates/times).

 

Any suggestions on how to do this?  Or maybe suggestions on a different way to build the chart?

 

Thanks in advance.IMG_8445.jpegIMG_8446.jpeg

 

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

Hi @Anonymous

 

Please try measure as:

Measure = 
IF(
    MONTH(MAX('Table'[Date]))=1,
    "red",
    "blue"
)

vxulinmstf_0-1629683718699.png

You can also use 'Year(MAX('Table'[Date]))=2021' or 'MAX('Table'[Date])="2021,08,01"'.

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

5 REPLIES 5
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

Please try measure as:

Measure = 
IF(
    MONTH(MAX('Table'[Date]))=1,
    "red",
    "blue"
)

vxulinmstf_0-1629683718699.png

You can also use 'Year(MAX('Table'[Date]))=2021' or 'MAX('Table'[Date])="2021,08,01"'.

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!

Anonymous
Not applicable

@v-xulin-mstf thanks for this solution.  Is there a way to color every month or quarter and have a legend or is this code only good for coloring a single month/quarter?

Hi @Anonymous

 

If you need to set different colors for multiple date ranges, you can use switch function.

Just like: 

= SWITCH([Month], 1, "red", 2, "green", 3, "yellow", 4, "blue", else)

 

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!

amitchandak
Super User
Super User

@Anonymous , You can create a color measure and use that

 

I have one example here, see if that can help

https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-4-Customers-to-Retain-Segment-in-4/ba-p/1421632

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak thanks for the answer.

 

Like i said above, I'm very new to Power BI and I'm having a difficult time taking the DAX code for your measure and converting it to what I need it to do.  How would I make a DAX code that will highlight red the dots for April 2021?  I'm struggling with what DAX commands to use for date...would I just use MONTH and YEAR?

 

Also, once I create a measure, what do I do with it to make it take effect...drag it to one of the details fields?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.