The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I'm measuring video views on a web page. I pull a total every few days. My data table has a list of video titles, and calculates the number of new views based on the new total minus the previous total. For each row there is a "report date".
In Power BI, I was able to use DAX to create a measure called "Duration" that uses the DATEDIFF formula to calculate the number of days from when the video launched to the last report date.
Duration = (DATEDIFF(min(MasterData[Report Date]),MAX(MasterData[Report Date]),DAY))
I apply a filter to the table to pull out the dates when views were below a certain threshhold. Everything looks good up to this point. I get a list that diplays the title of the video in one column and the duration of each after the low-outliers are filtered out. All I want is an average of this second column. But because it is a measure, I can't figure out how to calculate it.
My primary objective in all of this is to determine the most vigorous lifespan of a video once it is launched. That is, there is a period of time when the video is hot, and then it is a mere trickle the remaining time. I want to know the average hot span for video views--that is, how many days is a video hot for on average?
Thanks in advance!
I'm thinking create another measure with the formula:
AverageDuration = AVERAGE((DATEDIFF(min(MasterData[Report Date]),MAX(MasterData[Report Date]),DAY)))
@Greg_Deckler --thank you. I've tried that. I get the error: "The AVERAGE function only accepts a column reference as an argument."
Hmmm...
I didn't try this in testing, it's late where I am but perhaps try something like a custom column with a formula of:
DurationColumn = CALCULATE(DATEDIFF(min(MasterData[Report Date]),MAX(MasterData[Report Date]),DAY),ALLEXCEPT(MasterData[VideoTitle]))
I am assuming that you have a column called "VideoTitle" but just replace with actual column name.
Now that you have it in a column, you can take the average of it. Average could be skewed I suppose depending on your data model. Man, I must be missing something, this doesn't seem like it should be this complicated.
It's late here, I don't think my brain is working properly.
I wonder if you could alternatively try a measure like:
AVERAGEX(MasterData,DATEDIFF(min(MasterData[Report Date]),MAX(MasterData[Report Date]),DAY))