Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi Experts
See sample file.
https://www.dropbox.com/s/erp5exx8bbhi57v/Rolling%20%281%29.pbix?dl=0
I want to amend my meaure in my table (see below) so my start date is 9 months after the first date in the table i.e First Date is (dec-18) - hence start date should be (Aug-19). All previous values to be shown as blank(zero).
Solved! Go to Solution.
Hi @Anonymous ,
Similar issue here: https://community.powerbi.com/t5/Desktop/Tricky-Rolling-3-and-6-Months/td-p/1942330
Based on my test, you need to delete the relationship between two tables firstly.
And then please try this measure:
3 mtn Rolling =
VAR _LastDate =
LASTDATE ( 'RollingData'[Month] )
VAR _0 =
CALCULATE (
SUM ( RollingData[Month 0] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= _LastDate
&& [Month] > DATEADD ( _LastDate, -3, MONTH )
)
)
VAR _1 =
CALCULATE (
SUM ( RollingData[Month 1] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -1, MONTH )
&& [Month] > DATEADD ( _LastDate, -4, MONTH )
)
)
VAR _2 =
CALCULATE (
SUM ( RollingData[Month 2] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -2, MONTH )
&& [Month] > DATEADD ( _LastDate, -5, MONTH )
)
)
VAR _3 =
CALCULATE (
SUM ( RollingData[Month 3] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -3, MONTH )
&& [Month] > DATEADD ( _LastDate, -6, MONTH )
)
)
VAR _4 =
CALCULATE (
SUM ( RollingData[Month 4] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -4, MONTH )
&& [Month] > DATEADD ( _LastDate, -7, MONTH )
)
)
VAR _5 =
CALCULATE (
SUM ( RollingData[Month 5] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -5, MONTH )
&& [Month] > DATEADD ( _LastDate, -8, MONTH )
)
)
VAR _6 =
CALCULATE (
SUM ( RollingData[Month 6] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -6, MONTH )
&& [Month] > DATEADD ( _LastDate, -9, MONTH )
)
)
VAR _SUM = _0 + _1 + _2 + _3 + _4 + _5 + _6
RETURN
IF(DATEDIFF(MAX('Calendar'[Date]), MAX('RollingData'[Month]),MONTH)>=8,_SUM,BLANK())
The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Similar issue here: https://community.powerbi.com/t5/Desktop/Tricky-Rolling-3-and-6-Months/td-p/1942330
Based on my test, you need to delete the relationship between two tables firstly.
And then please try this measure:
3 mtn Rolling =
VAR _LastDate =
LASTDATE ( 'RollingData'[Month] )
VAR _0 =
CALCULATE (
SUM ( RollingData[Month 0] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= _LastDate
&& [Month] > DATEADD ( _LastDate, -3, MONTH )
)
)
VAR _1 =
CALCULATE (
SUM ( RollingData[Month 1] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -1, MONTH )
&& [Month] > DATEADD ( _LastDate, -4, MONTH )
)
)
VAR _2 =
CALCULATE (
SUM ( RollingData[Month 2] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -2, MONTH )
&& [Month] > DATEADD ( _LastDate, -5, MONTH )
)
)
VAR _3 =
CALCULATE (
SUM ( RollingData[Month 3] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -3, MONTH )
&& [Month] > DATEADD ( _LastDate, -6, MONTH )
)
)
VAR _4 =
CALCULATE (
SUM ( RollingData[Month 4] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -4, MONTH )
&& [Month] > DATEADD ( _LastDate, -7, MONTH )
)
)
VAR _5 =
CALCULATE (
SUM ( RollingData[Month 5] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -5, MONTH )
&& [Month] > DATEADD ( _LastDate, -8, MONTH )
)
)
VAR _6 =
CALCULATE (
SUM ( RollingData[Month 6] ),
FILTER (
ALL ( 'RollingData' ),
[Month] <= DATEADD ( _LastDate, -6, MONTH )
&& [Month] > DATEADD ( _LastDate, -9, MONTH )
)
)
VAR _SUM = _0 + _1 + _2 + _3 + _4 + _5 + _6
RETURN
IF(DATEDIFF(MAX('Calendar'[Date]), MAX('RollingData'[Month]),MONTH)>=8,_SUM,BLANK())
The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
146 | |
85 | |
66 | |
52 | |
48 |
User | Count |
---|---|
215 | |
90 | |
83 | |
67 | |
59 |