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
Fiala
Helper II
Helper II

counting days

Hellou, I have a problem with calculated column.
I have created this:

in how many days =
var val = 'Tab1'[Calling_Number]
var thisdate = 'Tab1'[CC_Call_Start_Day]
var nextdate = CALCULATE(min('Tab1'[CC_Call_Start_Day]),ALLEXCEPT('Tab1','Tab1'[Calling_Number]),'Tab1'[CC_Call_Start_Day]>thisdate)
var daysCount = CALCULATE(DATEDIFF(thisdate,nextdate,DAY),'Tab1'[Calling_Number]=val)
return
daysCount
 
But the result is wrong. I have a problem if calling_Number calls more then one a day.
Fiala_0-1614682225575.png

 


I have 2 million lines in the feed, so I'd rather avoid the value of time. It's very slow.
2 REPLIES 2
Fiala
Helper II
Helper II

@amitchandak Thank you. I added an INDEX column. But I don't know how to use it. I need to calculate the difference between two dates, so I have to use dates as well. The date column also has time, but when I work with time, the calculation stops when there is not enough memory.

amitchandak
Super User
Super User

@Fiala , does calling CC_Call_Start_Day has timestamp(some other date), if not add an index column and use it (Use in place of date)

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

Column will slow as this will this as column at the load time, but post that it should be fast.

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.

Top Solution Authors