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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Syndicate_Admin
Administrator
Administrator

Replace Month Values from Numbers to Names

Good morning.
I have a sheet that tells me the sales values I need based on some segmenters.

I have measures of "salesselected", "salesselectedprevious year", "salesselectedprevious month".

I have several segmenters, one of them is "month" from the month column and another is "year" from the year column.

If I apply the segmenters, all the values of the cards work perfectly.

I have added a table assigning the name of the month with its corresponding value, relating it to the table that contains the value "month", but that always affects the measure "salesselectedpreviousmonth", always showing a value "0" or "blank".

All I need is that in the "month" segmenter instead of showing "1" "January" appears and that everything continues to work the same.

Thanks in advance.

1 ACCEPTED SOLUTION
rosha_rosha
Resolver II
Resolver II

Hi 

  1.   Data Model: You have a SalesData table (month, year, sales) and a MonthNames table mapping month (1) to names (January). Ensure a one-to-many relationship between MonthNames[month] and SalesData[month].
  2. Segmenter: Use MonthNames[MonthName] in the segmenter to show names like "January".
  3. Fix salesselectedpreviousmonth: If the measure returns 0 or blank, it’s likely due to filter context issues. Check the DAX, e.g.:

salesselectedpreviousmonth =

CALCULATE(

    [salesselected],

    PREVIOUSMONTH('SalesData'[DateColumn]) -- Requires a date column

)

If no date column exists, calculate manually:

salesselectedpreviousmonth =

VAR CurrentMonth = SELECTEDVALUE('MonthNames'[month])

VAR CurrentYear = SELECTEDVALUE('SalesData'[year])

VAR PrevMonth = IF(CurrentMonth = 1, 12, CurrentMonth - 1)

VAR PrevYear = IF(CurrentMonth = 1, CurrentYear - 1, CurrentYear)

RETURN

CALCULATE(

    [salesselected],

    'SalesData'[month] = PrevMonth,

    'SalesData'[year] = PrevYear

)

  1. Use a Calendar Table: For better results, create a calendar table with Date, MonthNumber, MonthName, and Year. Relate it to SalesData using a calculated date (e.g., DATE(SalesData[year], SalesData[month], 1)). Then use:

salesselectedpreviousmonth =

CALCULATE(

    [salesselected],

    PREVIOUSMONTH('Calendar'[Date])

)

Test: Verify that selecting "January" in the segmenter shows correct values for all measures, including salesselectedpreviousmonth.

View solution in original post

5 REPLIES 5
v-csrikanth
Community Support
Community Support

Hi @Syndicate_Admin 

We haven't heard from you since last response and just wanted to check whether the solution provided has worked for you. If yes, please Accept as Solution to help others benefit in the community.
Thank you.

If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth.

v-csrikanth
Community Support
Community Support

Hi @Syndicate_Admin 

I wanted to follow up since I haven't heard from you in a while. Have you had a chance to try the suggested solutions?
If your issue is resolved, please consider marking the post as solved. However, if you're still facing challenges, feel free to share the details, and we'll be happy to assist you further.
Looking forward to your response!

Best Regards,
Community Support Team _ C Srikanth.



v-csrikanth
Community Support
Community Support

Hi @Syndicate_Admin 

Thank you for being part of the Microsoft Fabric Community.

As highlighted by @danextian , the proposed approach appears to effectively address your requirements. Could you please confirm if your issue has been resolved?
If you are still facing any challenges, kindly provide further details, and we will be happy to assist you.

Best Regards,
Community Support Team _ C Srikanth.

danextian
Super User
Super User

Hi @Syndicate_Admin 

Create this custom column in the query editor

Date.ToText(#date(2025, [month number column], 1), "MMMM")

The year and day elements can be different ones. The important thing is the columns returns a date with the correct month before being converted to a text month. Should be uppercase M as m in the query editor refers to minutes instead of months.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
rosha_rosha
Resolver II
Resolver II

Hi 

  1.   Data Model: You have a SalesData table (month, year, sales) and a MonthNames table mapping month (1) to names (January). Ensure a one-to-many relationship between MonthNames[month] and SalesData[month].
  2. Segmenter: Use MonthNames[MonthName] in the segmenter to show names like "January".
  3. Fix salesselectedpreviousmonth: If the measure returns 0 or blank, it’s likely due to filter context issues. Check the DAX, e.g.:

salesselectedpreviousmonth =

CALCULATE(

    [salesselected],

    PREVIOUSMONTH('SalesData'[DateColumn]) -- Requires a date column

)

If no date column exists, calculate manually:

salesselectedpreviousmonth =

VAR CurrentMonth = SELECTEDVALUE('MonthNames'[month])

VAR CurrentYear = SELECTEDVALUE('SalesData'[year])

VAR PrevMonth = IF(CurrentMonth = 1, 12, CurrentMonth - 1)

VAR PrevYear = IF(CurrentMonth = 1, CurrentYear - 1, CurrentYear)

RETURN

CALCULATE(

    [salesselected],

    'SalesData'[month] = PrevMonth,

    'SalesData'[year] = PrevYear

)

  1. Use a Calendar Table: For better results, create a calendar table with Date, MonthNumber, MonthName, and Year. Relate it to SalesData using a calculated date (e.g., DATE(SalesData[year], SalesData[month], 1)). Then use:

salesselectedpreviousmonth =

CALCULATE(

    [salesselected],

    PREVIOUSMONTH('Calendar'[Date])

)

Test: Verify that selecting "January" in the segmenter shows correct values for all measures, including salesselectedpreviousmonth.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors