Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi all,
I wonder if anyone can point me in the right direction with this.
I'm trying to get a value for the previous week (selected date-7) according to the selected date.
Now this gives me the value for the selected date:
Solved! Go to Solution.
Hi,
Try this aproach
Total = SUM('F - Actual and Projected EFTSL'[Actual EFTSL])
Total in previous week = calculate([Total],datesbetween(calendar[date],min(calendar[date])-7,min(calendar[date)))
Hope this helps.
Hi @DHB ,
Based on my testing, please try the following methods:
1.Create the sample table.
2.Create the measure to calculate the previous week.
PreviousWeekEFTSL =
CALCULATE(
SUM('Table'[Values]),
DATESBETWEEN('Table'[Date], MIN('Table'[Date]) - 7, MIN('Table'[Date]))
//DATEADD('Table'[Date], -7, DAY)
)
3.Drag the date column into the slicer visual.
4.Select the date. The result is shown below.
DATESBETWEEN function (DAX) - DAX | Microsoft Learn
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @DHB ,
Based on my testing, please try the following methods:
1.Create the sample table.
2.Create the measure to calculate the previous week.
PreviousWeekEFTSL =
CALCULATE(
SUM('Table'[Values]),
DATESBETWEEN('Table'[Date], MIN('Table'[Date]) - 7, MIN('Table'[Date]))
//DATEADD('Table'[Date], -7, DAY)
)
3.Drag the date column into the slicer visual.
4.Select the date. The result is shown below.
DATESBETWEEN function (DAX) - DAX | Microsoft Learn
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Try this aproach
Total = SUM('F - Actual and Projected EFTSL'[Actual EFTSL])
Total in previous week = calculate([Total],datesbetween(calendar[date],min(calendar[date])-7,min(calendar[date)))
Hope this helps.
What about something like:
Prior Week Version = VAR priorDate = SELECTEDVALUE('F - Actual and Projected EFTSL'[Snapshot Date]) - 7
VAR output = CALCULATE(
SUM('F - Actual and Projected EFTSL'[Actual EFTSL]),
ALL('F - Actual and Projected EFTSL'[Snapshot Date]),
'F - Actual and Projected EFTSL'[Snapshot Date] = priorDate
)
RETURN
output
Thank you @RossEdwards. Now that query doesn't error but it returns a blank in my table for some reason.
If I create a test measure just using this I do get the right date though:
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
110 | |
107 | |
92 | |
68 |
User | Count |
---|---|
167 | |
130 | |
129 | |
94 | |
91 |