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.
I have a table below in which i wanted to calculate or get the difference from this week's count against last week. below is a sample table output that i wanted to achieve. i wanted to get a dax formula for the Week Difference. Thank you in advance.
CountOfECMs | WEEKENDINGSAT | Week Difference |
21 | 12/2/2017 | |
30 | 12/9/2017 | 9 |
33 | 12/16/2017 | 3 |
11 | 12/23/2017 | -22 |
8 | 12/30/2017 | -3 |
11 | 1/6/2018 | 3 |
25 | 1/13/2018 | 14 |
32 | 1/20/2018 | 7 |
16 | 1/27/2018 | -16 |
17 | 2/3/2018 | 1 |
25 | 2/10/2018 | 8 |
20 | 2/17/2018 | -5 |
22 | 2/24/2018 | 2 |
19 | 3/3/2018 | -3 |
17 | 3/10/2018 | -2 |
Solved! Go to Solution.
Hi, @gheecalipes25
Please try formula like:
Week Difference =
VAR last_week =
CALCULATE (
MAX ( 'Table'[WEEKENDINGSAT] ),
FILTER (
ALL ( 'Table' ),
'Table'[WEEKENDINGSAT] < MAX ( 'Table'[WEEKENDINGSAT] )
)
)
VAR _count_of_lastweek =
CALCULATE (
[CountOfECMs1],
FILTER ( ALL ( 'Table' ), 'Table'[WEEKENDINGSAT] = last_week )
)
RETURN
IF (
ISBLANK ( _count_of_lastweek ),
BLANK (),
[CountOfECMs1] - _count_of_lastweek
)
Best Regards,
Community Support Team _ Eason
Hi, @gheecalipes25
Please try formula like:
Week Difference =
VAR last_week =
CALCULATE (
MAX ( 'Table'[WEEKENDINGSAT] ),
FILTER (
ALL ( 'Table' ),
'Table'[WEEKENDINGSAT] < MAX ( 'Table'[WEEKENDINGSAT] )
)
)
VAR _count_of_lastweek =
CALCULATE (
[CountOfECMs1],
FILTER ( ALL ( 'Table' ), 'Table'[WEEKENDINGSAT] = last_week )
)
RETURN
IF (
ISBLANK ( _count_of_lastweek ),
BLANK (),
[CountOfECMs1] - _count_of_lastweek
)
Best Regards,
Community Support Team _ Eason
@gheecalipes25 Easiest way would be to use a Sequential column: Sequential - Microsoft Power BI Community
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 |
---|---|
102 | |
99 | |
81 | |
77 | |
66 |
User | Count |
---|---|
134 | |
108 | |
104 | |
83 | |
73 |