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'm trying to build a graph that shows a year to date sum over each week for only the last 7 weeks. Currently I'm using this measure:
Qty_Sold_YTD = CALCULATE(SUM(Data[Qty_Sold]), DATESYTD('Calendar'[Date]))
and using a custom column that calculates the week number to filter to only weeks that were between now and 7 weeks ago. However, when I apply these filters, all the data from before 7 weeks ago doesn't get included. I have this measure which I think should do it, I'm just not sure how to add this value to Qty_Sold_YTD:
QTY_Sold_Before_7_Weeks_Ago = CALCULATE( SUM(Data[Qty_Sold]), FILTER( Data, WEEKNUM(TODAY())-WEEKNUM(Data[Date])<7 ) )
Solved! Go to Solution.
Hi @travbum,
To achieve your requirement, you can use the DAX below.
QTY_Sold_Before_7_Weeks_Ago = CALCULATE(SUM(data[Qty_Sold]),FILTER(ALL(data),data[Date]<=MAX(data[Date])&&(WEEKNUM(TODAY())-WEEKNUM(data[Date]))<7))
Regards,
Charlie Liao
Hi @travbum,
To achieve your requirement, you can use the DAX below.
QTY_Sold_Before_7_Weeks_Ago = CALCULATE(SUM(data[Qty_Sold]),FILTER(ALL(data),data[Date]<=MAX(data[Date])&&(WEEKNUM(TODAY())-WEEKNUM(data[Date]))<7))
Regards,
Charlie Liao
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |