The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I'm currently trying to modify a formula to show only past 4 weeks of sales. Currently, the formula shows average unit sales for all selected weeks in the dashboard.
This is the current formula:
Solved! Go to Solution.
First: Do you have a contiguous Date dimension attached to your fact table. Let's assume you do.
Create a calculated column in the Date table of [Weeks Back] = DATEDIFF(WEEK, 'Date'[Date], TODAY() )
NOTE: Not sure if the DAX is 100% accurate here, going from memory.
Now create your measure:
Last Four Weeks Sales = CALCULATE ( SUM ( <some column> ), 'Date'[Weeks Back] IN {1, 2, 3, 4} )
Proud to be a Super User! | |
First: Do you have a contiguous Date dimension attached to your fact table. Let's assume you do.
Create a calculated column in the Date table of [Weeks Back] = DATEDIFF(WEEK, 'Date'[Date], TODAY() )
NOTE: Not sure if the DAX is 100% accurate here, going from memory.
Now create your measure:
Last Four Weeks Sales = CALCULATE ( SUM ( <some column> ), 'Date'[Weeks Back] IN {1, 2, 3, 4} )
Proud to be a Super User! | |
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
95 | |
93 | |
85 | |
68 | |
65 |
User | Count |
---|---|
241 | |
124 | |
121 | |
81 | |
79 |