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.
Hello,
I have created WTD/MTD/QTD/YTD slicer based on below formula. The formulas are working fine when in Data Pane on Left when I choose WTD it shows currrent week which is completely correct as seen in below picture.
Hi @Junaid11 ,
The two fields(Period and DollarSales) in the table visual below are fields from which fact table? Are they from the fields in table PuigWeeklySkuByStore_data2? If so, does the table PuigWeeklySkuByStore_data2 and the newly created calculated table "WTD/MTD/QTD/YTD" create a relationship based on the date field? If not, could you provide some sample data from the tables involved(exclude sensitive data)? It is better if you can provide a simplified pbix file without any sensitive info. Thank you.
In addition, you can refer the following links to get the WTD calculation.
Week to Date Calculation in Power BI with DAX
Power BI — WTD Questions— Time Intelligence 4–5
WTD Calculation (See the post from mno on Jan' 21)
Best Regards
@Junaid11 , I usually use a measure like this for WTD with week rank and week day
WTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank]) && 'Date'[WeekDay]<=max('Date'[WeekDay])-1))
LWTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1 && 'Date'[WeekDay]<=max('Date'[WeekDay])-1 ))
,
new columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
WeekDay = WEEKDAY([Date],2) //monday
WTD based on today
This Week today =
var _st = today() +-1*WEEKDAY(today(),2)+1
var _end =today()
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filter
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
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 |
---|---|
112 | |
97 | |
85 | |
68 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |