cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
goutamgm92 Frequent Visitor
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
Super User
Super User

Re: Date column displays all months in the year

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 a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
goutamgm92 Frequent Visitor
Frequent Visitor

Re: Date column displays all months in the year

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?