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
Anonymous
Not applicable

Display date slicer in MMM-YYYY without the calculation being broken

I have a table in Power BI which has two date columns-

1. Data refresh month - it has the list of dates for every month and it's the date when monthly refresh of the data happens

2. Data week month - it has the value of 6 months for each refresh months. Selected month from Data refresh month + 5 previous months

 

Now I am using the data refresh months for calculating Current months sales & Previous months sales and displaying that in a line chart, with Data week month on X axis.

 

Also, there is a date slicer, and I need to show the just Month & year in the slicer, so I created a column using Data refresh month to extract month & year.

When I am making a selection from the slicer after introducing the MMM-YYYY (which is a text daya type), on line chart I could only see current sales, and the previous sales disappears.

I hope I was able to explain the situation.

What am I missing or doing wrong?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

Thanks for Bibiano_Geraldo  and danextian 's concern about the problem, and i want to offer some more information for user to refer to.

hello @Anonymous ,  you need to create a calendar table to put it to the slicer without any relationship with data table, you can refer to the following sample.

Sample data 

vxinruzhumsft_0-1737941599621.png

Create a calaendar table(There are no relationship between tables.)

 

Calendar = ADDCOLUMNS(CALENDAR(DATE(2024,1,1),TODAY() ),"Month-Year",FORMAT([Date],"MMMM-YYYY"))

 

Then create a measure.

 

MEASURE =
VAR a =
    EOMONTH ( MAX ( 'Calendar'[Date] ), -6 ) + 1
RETURN
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            'Table',
            'Table'[Date] >= a
                && 'Table'[Date] <= MAX ( 'Calendar'[Date] )
        )
    )

 

Then put the "Month-Year" field of the calendar tablt to the slicer, and put the date column and the measure to the line visual.

vxinruzhumsft_1-1737941893753.png

 

vxinruzhumsft_2-1737941906085.png

 

Output

vxinruzhumsft_3-1737941950292.png

 

Best Regards!

Yolo Zhu

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

3 REPLIES 3
Anonymous
Not applicable

Hi,

Thanks for Bibiano_Geraldo  and danextian 's concern about the problem, and i want to offer some more information for user to refer to.

hello @Anonymous ,  you need to create a calendar table to put it to the slicer without any relationship with data table, you can refer to the following sample.

Sample data 

vxinruzhumsft_0-1737941599621.png

Create a calaendar table(There are no relationship between tables.)

 

Calendar = ADDCOLUMNS(CALENDAR(DATE(2024,1,1),TODAY() ),"Month-Year",FORMAT([Date],"MMMM-YYYY"))

 

Then create a measure.

 

MEASURE =
VAR a =
    EOMONTH ( MAX ( 'Calendar'[Date] ), -6 ) + 1
RETURN
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            'Table',
            'Table'[Date] >= a
                && 'Table'[Date] <= MAX ( 'Calendar'[Date] )
        )
    )

 

Then put the "Month-Year" field of the calendar tablt to the slicer, and put the date column and the measure to the line visual.

vxinruzhumsft_1-1737941893753.png

 

vxinruzhumsft_2-1737941906085.png

 

Output

vxinruzhumsft_3-1737941950292.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Bibiano_Geraldo
Super User
Super User

Hi @Anonymous ,

Please provide a sample data and share expected output and the issue you're facing

danextian
Super User
Super User

Hi @Anonymous 

 

It would be easier for us to figure out what you're trying to do if you provided a workable sample data (not an image), your expected result from that and the reasoning behind.





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.

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.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors