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
Hello All,
I am trying to compare Compare a week data to prior week's data - Week data may be less than 7 days, so need to compare the same number of days.
Data has 4 days in week 23.
Need to compare to the first 4 days in week 22
Getting the following error on my Max Week Day
Many thanks for your suggestions.
Open to other ways to do it.
Thanks,
Pav
Solved! Go to Solution.
I typically add columns to the date dimension YearsFromToday, MonthsFromToday, DaysFromToday, etc.
Negative is in the past, 0 is the current, positive is the future.
I have access to the DB views, but you can do this in Transform as well. See example, you could also have a "WeeksFromToday"
Then your DAX becomes stupid simple, to use your example:
Sale Count Week 1 = Calculate(Sale_count, DaysFromToday > -7 && DaysFromToday <= 0)
Sale Count Week 2 = Calculate(Sale_count, DaysFromToday > -14 && DaysFromToday <= -7)
....
Or better yet, leave sale count as it is and just apply a filter to the KPI or visual (unless you want to combine different weeks on different lines or etc on the same viz) Then you don't need a new measure for every week.
example:
If I answered your question, please mark my post as solution, Appreciate your Kudos
Thanks
I typically add columns to the date dimension YearsFromToday, MonthsFromToday, DaysFromToday, etc.
Negative is in the past, 0 is the current, positive is the future.
I have access to the DB views, but you can do this in Transform as well. See example, you could also have a "WeeksFromToday"
Then your DAX becomes stupid simple, to use your example:
Sale Count Week 1 = Calculate(Sale_count, DaysFromToday > -7 && DaysFromToday <= 0)
Sale Count Week 2 = Calculate(Sale_count, DaysFromToday > -14 && DaysFromToday <= -7)
....
Or better yet, leave sale count as it is and just apply a filter to the KPI or visual (unless you want to combine different weeks on different lines or etc on the same viz) Then you don't need a new measure for every week.
example:
If I answered your question, please mark my post as solution, Appreciate your Kudos
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 |
---|---|
99 | |
93 | |
81 | |
63 | |
56 |
User | Count |
---|---|
248 | |
124 | |
111 | |
78 | |
78 |