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
malpani
Helper I
Helper I

Deneb Visual Vegalite - Duplicate labels (Month-Year) on X axis

Hello Experts, 

I am creating a PBI custom visual using Deneb Vegalite and I am facing problem with X axis labels. Visual is shown in the attched image.

image.png

 
 

On X axis, I have Date type column named 'Date_Roadmap' which I have formatted to show in month-year format. On Y axis, I am showing release name. As marks I am showing milestones (C1, C2 etc) for those releases.

 

Problem - Today, visual generating as same labels on X axis as many times as I have Milestones (marks) in same month. For e.g. I have 3 milestones in month of June for different date in same month June. So, on X axis, it is generating same label June 2023 for 3 times instead of one. 

 

Expected Output:

I would like to show marks based on dates at same positions but on X axis, I would like to show unique labels for Month-Year.

 

image.png

 

Here is my code for your reference. Month-Year label could be at center, start or end.

 

regards

 

 

 

 

8 REPLIES 8
giammariam
Super User
Super User

Hi @malpani, thanks for the .pbix. For both of your x-axes keep the type as temporal and make sure you set 

"timeUnit": "yearmonth",

 

giammariam_0-1705350552648.png
Going by your formatting, I'm assuming you only want the month and year. This should get rid of the duplicates.

If this is enough to get you going please consider liking this reply and choosing it as the solution. Otherwise, I'm happy to help further.






Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

Hi @giammariam 
Thanks for your help. 

But I expect the marks shown by date and axis labels by unique Month-Year.
As you see, if you change both X axis encoding to temporal, marks overlap with each other. 
We had two marks in July C3 and C5 but with temporal they overlap with each other which is not readable. 
So, I would like to keep the same position for C3 and C5 by date in a month but when it comes to label show only once per month.

Hi @giammariam : Do you think it is possible to have month-Year on X axis but marks shown by dates.

What if we calculate Month-Year column Date column Power Query or by DAX and then use that column ?

@malpani, apologies, but I'm not fully comprehending what your end goal is. However, I have a sneaking suspicion that your solution will involve resolving the scales. Read more about resolve here.



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

@giammariam :
I have milestones based on dates, so in same month it is possile to have multiple milestones.
When I am trying to show Month-Year on X axis as labels using timeunit monthyear and type temporal, all milestones (marks) which belong to the same month overlap each other.

To make all milestones (marks) visile and do not overlap, I am using date to position marks but as a consecuence of that it show too many repeated labels for Month-Year meaning it shows label for each mark. 
Instead even if there are milstones (marks) distriuted by date in same month, I want to show them at different position but on X axis, I want to show label once for each month-year.

Thanks for that @malpani. I got closer, see here. However, with the data that you provided, you can see that the milestones overlap when there are more than 2 in a given month.

An alternative way that this may be able to be handled is that you facet the data so that each column is a month-year. Then within each facet you could have the milestones laid out sequentially. To do this though, you'd want to have your dataset include rows for month-years that have no milestones (e.g. February - June, plus September in this dataset) so they show in the facet. If you're able to set up your dataset to include these additional rows, I can give this a shot.



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!
malpani
Helper I
Helper I

Hi @giammariam 
Thank you for looking into this. I tried earlier with temporal as well but that doesn't help and also reduces the gap between labels and marks which makes it overlapping. 

Here is the link to sample PBIx file for your reference.

Sample PBIx file

giammariam
Super User
Super User

Hey @malpani, does changing the "type" under the x encoding from "nominal" to "temporal" solve it? If not, I'll be happy to look further. I'd just need some data that is structured similarly to your actual data (here's how).



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

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.