Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hi,
I am working on a personal project for work that requires a user to select a Week Number (W1 2023) and based on this slicer, it should show the current stock as of the last day of W1 2023. Right now, if I just use this without DAX I get the stock total based on the starting date to ending date, which is obviously not the way stock works. 🙂
Here is the premise:
I have the following simple model. On the Trading_Calendar table I have a column containing the start date and end date of a particular week.
If I do the following:
Solved! Go to Solution.
@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. 🙂
@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-La...
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. 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.