Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all
I'm trying to do what I thought was a straightforward moving average calculation based the rate of crashed deals over the previous 3 months.
I've created a measure with the following DAX
Hi @stuieb
The second argument for DATESINPERIOD has to be a single value (start date). You are passing exactliy the same as the first argument, which seems to be a full column. You'll probably need to use SELECTEDVALUE( ), MAX( ) or something similar depending on what you want to do and where your measure is used
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
Thank you for replying @AlB
This is probably my incorrect thinking. But what I am trying to pass to DATESINPERIOD is the current column value over the interated rows, that is to say, the current value of the date field in the row contex
If that's not possible, how could I calculate back to get an average for the previous 3 months?
Regards
Have you tried what I suggested?
CrashTrend = AVERAGEX(FILTER(Opportunity, DATESINPERIOD(Opportunity[Date_Off_Market__c], MAX(Opportunity[Date_Off_Market__c]), -3, MONTH)), [CrashRate])
If it doesn't work, you probably need to add an ALL to Opportunity in the first argument of FILTER. Otherwise I would need to see more details fo the data model to be able to come up with an accurate answer. Ideally a pbix that reproduces the problem
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
Hi @AlB
Yes, I have tried and unfortunately it doesn't work. The error is the same, wrapping the Opportunity in ALL() doesn't make a difference.
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |