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
goutamgm92
Frequent Visitor

Date column displays all months in the year

In a table, I am having a column with the date. I have only 6 months of Date in the table.

 

When I pull the column to a slicer, it shows the first date and last date correctly where as when I pull the date to a table, it lists all the months. Is this a bug?

 

I want to calculate the number of months I have selected, but the measure always ends up showing 12 instead of 6.

 

The measure I am using is 

 

CountOfMonths = DATEDIFF(FIRSTDATE(Table1[SampleDate].[Date]),
    LASTDATE(Table1[SampleDate].[Date]),MONTH)

 

image.png

2 REPLIES 2

No, it’s not a bug. After dragging to the table, find the date column drop down arrow (right hand side in the fields list, rows section) click the drop down arrow and change to date. This is the auto date hierarchy at work. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

When we are dragging a particular column from a table which just contains 6 months of data, the data hierarchy should display only the 6 months right. Please correct me if I am wrong.

 

Also the measure for some reason displays 11 months and not 12. What formula should I use for the measure for it to properly show the value as 6?

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.