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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
HarmVanG
Helper I
Helper I

Change axis labels to a custom format

Dear community,

 

I'm currently working on converting old excel dashboards into Power BI at the company that I work.

 

There is an issue however that I'm currently have to work with data that only has years and months, though they are formatted as a number and string in seperate collumns.

 

One of the tasks that I've had was to create a chart that shows the last 13 months on a line chart. I've done this by creating a month number from the strings in the month collumn, and then combining the year+month to use for the X-axis.

 

The business however would like to see a simple notation of jan, feb, mar etc.

They would also like to see a filter/slicer for quarters in the future.

 

Is there a way to easily do this?

 

Thanks in advance,

 

Harm

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @HarmVanG,

 

Here is an other option that can achieve your requirement. The goal is to generate a date column, so, we first create calendar table. You don't need to create a relationship between date table and source table.

Dim date =
FILTER (
    CALENDAR ( DATE ( 2016, 1, 1 ), DATE ( 2017, 12, 31 ) ),
    DAY ( [Date] ) = 1
)

Then, in your source table, suppose, currently, you have had two columns [Month] and [Year], both are whole number type. Now, you need to create a calculated column.

Day =
LOOKUPVALUE (
    'Dim date'[Date],
    'Dim date'[Date].[Year], 'Year-Month'[Year],
    'Dim date'[Date].[MonthNo], 'Year-Month'[Month]
)

3.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @HarmVanG,

 

Was above reply helpful to your scenario? If so, please kindly mark the corresponding reply as an answer so that it can benefit more people. If you still have any concern, please feel free to ask.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @HarmVanG,

 

Here is an other option that can achieve your requirement. The goal is to generate a date column, so, we first create calendar table. You don't need to create a relationship between date table and source table.

Dim date =
FILTER (
    CALENDAR ( DATE ( 2016, 1, 1 ), DATE ( 2017, 12, 31 ) ),
    DAY ( [Date] ) = 1
)

Then, in your source table, suppose, currently, you have had two columns [Month] and [Year], both are whole number type. Now, you need to create a calculated column.

Day =
LOOKUPVALUE (
    'Dim date'[Date],
    'Dim date'[Date].[Year], 'Year-Month'[Year],
    'Dim date'[Date].[MonthNo], 'Year-Month'[Month]
)

3.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

My company recently released a free custom visual on App Source that allows custom labels on column charts.  https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA200001785?tab=Overview  With the advanced editor you can pick which columns or DAX measures to use for the labels.

vanessafvg
Super User
Super User

@hat i would do @HarmVanG is create a date table,  conver the month-year column, transform the year month to a 1 of every month and then you have the functionality fo what comes with a date table

 

apparently this creates a date column but i could be wrong i copied from elsewhere and didnt' validate

InsertedCustom = Table.AddColumn(Source, "Custom", each Date.FromText([Month] & " 15," & Number.ToText([Year])))

and then link it to this

 

https://www.mattmasson.com/2014/02/creating-a-date-dimension-with-a-power-query-script/

 

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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