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 August 31st. Request your voucher.
Hello everyone,
I have an issue and i'm stuck.
I try to make a sum of PTS of the last fives dates. As you can see, it's rolling by the following dates.
For the rows 5,4,3,2,1 . I'm just making a cumulate until I have 5 rows of dates.
Thanks a lot for your help.
Regards
Kevin
Solved! Go to Solution.
OK, so I did this:
Index = COUNTROWS(FILTER('Table',[date] <= EARLIER([date])))
And then this:
Rolling 5 Last Days =
VAR __Count = COUNTROWS(FILTER('Table',[date] <= EARLIER([date])))
VAR __Min = [Index] - 5 + 1
RETURN
IF(
__Count >= 5,
SUMX(FILTER('Table',[Index] >= __Min && [Index] <= EARLIER([Index])),[PTS]),
SUMX(FILTER('Table',[date] <= EARLIER([date])),[PTS])
)
PBIX is attached.
OK, so I did this:
Index = COUNTROWS(FILTER('Table',[date] <= EARLIER([date])))
And then this:
Rolling 5 Last Days =
VAR __Count = COUNTROWS(FILTER('Table',[date] <= EARLIER([date])))
VAR __Min = [Index] - 5 + 1
RETURN
IF(
__Count >= 5,
SUMX(FILTER('Table',[Index] >= __Min && [Index] <= EARLIER([Index])),[PTS]),
SUMX(FILTER('Table',[date] <= EARLIER([date])),[PTS])
)
PBIX is attached.
Hi Greg,
You're my hero ! I was tearing my hair all this time.
Thank you very much
Kevin
User | Count |
---|---|
27 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
32 | |
15 | |
12 | |
12 | |
7 |