To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have used these Dax formula to calculate Previous Week but results are incorrect, can someone please help me rectify this? Thanks in advance.
First Formula used populates column but values are incorrect.
Previous Week in Second Forumula shows blank Values
@ValtteriN Can you assist? I do not have lastWeek as a table to filter on, so I used calendar and here are my results.
Dax Formula:
Hi @Merle,
You can try to use the following formula to get the previous week amounts:
formula =
VAR currdate =
MAX ( Calendar[Date] )
VAR weekStart =
IF (
WEEKNUM ( currdate, 1 ) <> 1,
currdate - WEEKDAY ( currdate, 1 ) + 1,
DATE ( YEAR ( currdate ), 1, 1 )
)
RETURN
CALCULATE (
SUM ( Table[TOTAL_ACTIONS] ),
FILTER (
ALLSELECTED ( Table ),
YEAR ( [Date] )
= YEAR ( weekStart - 1 )
&& WEEKNUM ( [Date] , 1 )
= WEEKNUM ( weekStart - 1 , 1 )
)
)
Regards,
Xiaoxin Sheng
Hi Valtterin,
Thank you for your response. The results I am looking for is Actions for the last week to the current week values not the actual week num.
Hi,
Try using WEEKNUM e.g.
Proud to be a Super User!
User | Count |
---|---|
14 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
29 | |
17 | |
11 | |
7 | |
5 |