Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I have imported a csv file as dataset. The dataset contains incident records for 6 months and it has date field of type date. I need a number of days in the dataset i.e. a number of days that has an incident record. I have tried to create a measure using DISTINCTCOUNT but it returns 365 as value i.e. the number of days in the calendar year instead of just the dates for the incident records that exist in the dateset (6 months) .
"Days with incidents = DISTINCTCOUNT(('DataSet All Incidents Last 6 Months'[Created Date].[Date]))"
I have tried using FILTER to only include rows from the dateset but that doesn't give the right result either.
br
Lars
Solved! Go to Solution.
Try the below, without .[Date]
Days with incidents = DISTINCTCOUNT( 'DataSet All Incidents Last 6 Months'[Created Date] )
When you referring to .[date] you are in fact referring to a hidden date dimension that will create a min of a full year that's why you see 365, to avoid it you can split you DateTime in the Query Editor or model and then count distinct on the date field
Try the below, without .[Date]
Days with incidents = DISTINCTCOUNT( 'DataSet All Incidents Last 6 Months'[Created Date] )
Hi @Mariusz
Thanks but that (without .[date]) gives a number equal to number of rows in the dataset. The dataset looks like this in query editor. The Created Date type is of "Date/Time". There incidents is from may to november so if incidents is registered every day in those 6 months I should get a number of around 180 distinct days.
br
Lars
When you referring to .[date] you are in fact referring to a hidden date dimension that will create a min of a full year that's why you see 365, to avoid it you can split you DateTime in the Query Editor or model and then count distinct on the date field
Thx @Mariusz ,
I duplicated the "Created Date" column and changed the type to just Date, so now I get the right number. I guess using split in the quey is a more proper ways of acheiving the goal so will try that also.
br
Lars
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.