Forum Discussion
Filter Quantity on Week-to-date based on Slicer selection
- 3 years ago
amitchandak, thanks for the links that you provided. It definitely pointed me to the right direction.
I am able to solve my requirements by doing the following:
I added a CURRENT DAY OFFSET COLUMN in power query using the following:
Number.From([Date]) - Number.From(Date.From( DateTime.FixedLocalNow()))
This gives me an integer value showing this:
Based on this I made the following DAX statement:
SOH =VAR currOffset = MAX(Dim_Trading_Calendar[Curr Day Offset])//Takes the maximum offset of the current selection in this case// -11 as my slicer selection was W8 2023VAR WTDSelection = CALCULATE(SUM(Fact_Stock_w_Cost[Qty]),//I wanted to sum the Qty Column from this tableALL(Dim_Trading_Calendar),//I wanted to clear all filters from my calendar table, in this case current//selection is Week 8 2023Dim_Trading_Calendar[Curr Day Offset] <= currOffset//I apply a new filter where the offset is less than or equal to -11.//It gives me a filter of all columns prior and including the 26 FEB 2023)RETURN WTDSelectionI hope this helps someone else. 🙂
cgaralde , refer if my week rank way
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-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8
Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
You can also consider window
Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
amitchandak, thanks for the links that you provided. It definitely pointed me to the right direction.
I am able to solve my requirements by doing the following:
I added a CURRENT DAY OFFSET COLUMN in power query using the following:
Number.From([Date]) - Number.From(Date.From( DateTime.FixedLocalNow()))
This gives me an integer value showing this:
Based on this I made the following DAX statement:
I hope this helps someone else. 🙂