Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Can somebody please help with this issue
I need to filter my sales and stock table with date slicer
so here is my SQL Query:
Solved! Go to Solution.
You can overwrite the current date selection using the CALCULATE function then use the DATESBETWEEN function to specify a new date range
It's not clear if you are using a date table but if you are the calculation could look something like this
Stock Level =
VAR StartDate =
DATE ( 1900, 1, 1 )
VAR EndDate =
MAX ( 'Date'[Date] )
VAR TotalStock =
CALCULATE (
[Stock QTY] ,
DATESBETWEEN ( 'Date'[Date], StartDate, EndDate )
)
RETURN
TotalStock#this code is not tested so may contain typos
@ki855 ,
You may take a look at the following post.
https://community.powerbi.com/t5/Desktop/Apply-date-slicer-to-GROUPBY-table/td-p/459577
Thanks for help
but I really need to write DAX for filtering my Sales table and stock table with 1 slicer
For sales table it should work as is
But for stock table it should work from beginning of history
like I wrote on SQL QUERY above
You can overwrite the current date selection using the CALCULATE function then use the DATESBETWEEN function to specify a new date range
It's not clear if you are using a date table but if you are the calculation could look something like this
Stock Level =
VAR StartDate =
DATE ( 1900, 1, 1 )
VAR EndDate =
MAX ( 'Date'[Date] )
VAR TotalStock =
CALCULATE (
[Stock QTY] ,
DATESBETWEEN ( 'Date'[Date], StartDate, EndDate )
)
RETURN
TotalStock#this code is not tested so may contain typos
Thanks for help
Here is the link for pbix
If anyone want to test
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 98 | |
| 72 | |
| 50 | |
| 50 | |
| 43 |