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.
The following formula calculates Total Sessions last 14 days (dynamic for the last date).
Total Sessions last 14 days = CALCULATE(SUM('Table1'[Total Sessions]), DATESBETWEEN('Table1'[Date], DATEADD(LASTDATE('Table1'[Date]),-13,DAY), LASTDATE('Table1'[Date])))
So, my assumption is that the current day is inclusive and thus including the past 13 days, in addition to the current, would yield me a measure of the last 14 days.
Measuring the Total Sessions with one-month lag I use the following formula
1 month back total sessions = CALCULATE(SUM('Table1'[Total Sessions]), DATESBETWEEN('Table1'[Date], DATEADD(LASTDATE('Table1'[Date]),-44,day), DATEADD(LASTDATE('Table'[Date]),-31,DAY) ))
If my understanding is correct of the formula above, it should return the Total Sessions over 14 days, lagged with 31 days from the current date.
Is there perhaps a more elegant solution, to calculating a period of 2 weeks dynamic from the last date in the dataset, compared to the same 2 weeks period but with a one-month lag?
Thanks
Any ideas :)?
Measure 1onePrev =
VAR Month_1=DATEADD(LASTDATE(Table1[Date]);-1;MONTH)
RETURN
CALCULATE(SUM(Table1[Value]);DATESBETWEEN(Table1[Date];Month_1-13;Month_1))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |