Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have a scenario where I have to display the sales for the latest week, in my data i have weekstart date and weekend date,
Since the latest weekstart date is 04-05-2020 and latest weekend date is 10-05-2020 I have sales value as 0 for this week as the week has not yet ended.
So i have to display sales for the previous week, whenever the sales value is 0, I should display the previous week sales i.e. 27-04-2020 to 03-05-2020 this week sales should be displayed.
Can anyone suggest me how to achieve this
Solved! Go to Solution.
@Anonymous , You can actually calculate a week rank to get this week and last week data.
If (isblank([This Week]),[Last Week],[This Week])
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Hi @Anonymous ,
You could also use WEEKNUM() function to get week like RANKX(). Then refer to Amit's DAX.
Hi @Anonymous ,
You could also use WEEKNUM() function to get week like RANKX(). Then refer to Amit's DAX.
@Anonymous , You can actually calculate a week rank to get this week and last week data.
If (isblank([This Week]),[Last Week],[This Week])
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Thank you so much for the help
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
74 | |
63 | |
51 | |
47 |
User | Count |
---|---|
211 | |
85 | |
64 | |
59 | |
56 |