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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Need Distinct Values of "Month" in Slicer

Hello.

I have a Completion Date field which is in Date/Time format.

I then created a Completion Month field which I made = Completion Date then formatted Completion Month to "mmm yyyy".

Then I created a slicer for Completion Month, but I see multiple values of Completion Month.
How do I just show 1 value of "Nov 2023", 1 value of "Dec 2023", etc. in the slicer, versus many "Nov 2023", "Dec 2023", etc.

I tried to use DISTINCT function but got the error "A table of multiple values was supplied where a single value was expected".

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You can use the formatted field as a slicer through the SUMMARIZE function.

Refer to the following dax:

slicer =
VAR _table2 =
    SUMMARIZE (
        'Table',
        [Completion  Date],
        "sli_Month", FORMAT ( 'Table'[Completion  Date], "mmmm-yyyy" )
    )
RETURN
    SUMMARIZE ( _table2, [sli_Month] )

vkongfanfmsft_0-1705304007443.png

 

Best Regards,
Adamk Kong

 

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

7 REPLIES 7
Anonymous
Not applicable

Hi @Anonymous ,

 

You can use the formatted field as a slicer through the SUMMARIZE function.

Refer to the following dax:

slicer =
VAR _table2 =
    SUMMARIZE (
        'Table',
        [Completion  Date],
        "sli_Month", FORMAT ( 'Table'[Completion  Date], "mmmm-yyyy" )
    )
RETURN
    SUMMARIZE ( _table2, [sli_Month] )

vkongfanfmsft_0-1705304007443.png

 

Best Regards,
Adamk Kong

 

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

Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor or in a calculated column of the data model, remove time stamp.  Create a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name column by the Month number column.  Create a relationship (Many to One and Single) from the Data column of the Data Table to the Date column of the Calendar Table.  To any visual/slicer/filter, drag any date dimension from the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AmiraBedh
Super User
Super User

Try the following :

Completion Month-Year Table = 
SUMMARIZE(
    YourTableName,
    YourTableName[Completion Date],
    "Completion Month-Year", FORMAT(YourTableName[Completion Date], "MMM YYYY")
)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
Anonymous
Not applicable

Got an error. New Table.png

It is a calculated table and not a calculated column.

Meanwhile : 

Completion Month-Year Table = 
SUMMARIZE(
    YourTableName,
    ADDCOLUMNS(
        YourTableName,
        "Month-Year", FORMAT(YourTableName[Completion Date], "MMM YYYY")
    ),
    [Month-Year]
)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
Anonymous
Not applicable

Here is the created table. I am seeing multiple month values; Screenshot 2024-01-08 145559.png

I am sorry but I am confused what is your actual input and expected output ?


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.